Changeset 37


Ignore:
Timestamp:
06/01/07 08:51:36 (8 years ago)
Author:
guyru
Message:

cleaned up the post scoring code

Location:
trunk/OpenYahtzee
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/OpenYahtzee/openyahtzee.kdevelop

    r36 r37  
    223223    <custom>false</custom> 
    224224    <bzip>false</bzip> 
    225     <archname/> 
     225    <archname></archname> 
    226226    <appname>OpenYahtzee</appname> 
    227227    <version>1.6</version> 
    228     <release/> 
     228    <release></release> 
    229229    <vendor>Guy Rutenberg</vendor> 
    230230    <licence>GPL</licence> 
    231     <summary/> 
    232     <group/> 
    233     <packager/> 
    234     <description/> 
    235     <changelog/> 
     231    <summary></summary> 
     232    <group></group> 
     233    <packager></packager> 
     234    <description></description> 
     235    <changelog></changelog> 
    236236    <devpackage>false</devpackage> 
    237237    <docspackage>false</docspackage> 
     
    242242    <ftpkde>false</ftpkde> 
    243243    <appskde>false</appskde> 
    244     <url/> 
     244    <url></url> 
    245245  </dist> 
    246246</kdevelop> 
  • trunk/OpenYahtzee/openyahtzee.kdevses

    r36 r37  
    22<!DOCTYPE KDevPrjSession> 
    33<KDevPrjSession> 
    4  <DocsAndViews NumberOfDocuments="12" > 
     4 <DocsAndViews NumberOfDocuments="13" > 
    55  <Doc0 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/SettingsDB.h" > 
    66   <View0 Type="Source" /> 
    77  </Doc0> 
    88  <Doc1 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/openyahtzee.cpp" > 
    9    <View0 Type="Source" /> 
     9   <View0 line="30" Type="Source" /> 
    1010  </Doc1> 
    1111  <Doc2 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/MainFrame.cpp" > 
    12    <View0 Type="Source" /> 
     12   <View0 line="539" Type="Source" /> 
    1313  </Doc2> 
    1414  <Doc3 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/ObjectsID.h" > 
     
    1616  </Doc3> 
    1717  <Doc4 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/MainFrame.h" > 
    18    <View0 Type="Source" /> 
     18   <View0 line="71" Type="Source" /> 
    1919  </Doc4> 
    2020  <Doc5 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/DBwrapper.h" > 
     
    2525  </Doc6> 
    2626  <Doc7 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/SettingsDialog.cpp" > 
    27    <View0 line="107" Type="Source" /> 
     27   <View0 Type="Source" /> 
    2828  </Doc7> 
    2929  <Doc8 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/SettingsDB.cpp" > 
     
    3434  </Doc9> 
    3535  <Doc10 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/HighScoreDialog.cpp" > 
    36    <View0 line="160" Type="Source" /> 
     36   <View0 line="32" Type="Source" /> 
    3737  </Doc10> 
    3838  <Doc11 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/Icon.h" > 
    3939   <View0 line="34" Type="Source" /> 
    4040  </Doc11> 
     41  <Doc12 NumberOfViews="1" URL="file:///home/guy/workspace/OpenYahtzee/src/openyahtzee.rc" > 
     42   <View0 line="19" Type="Source" /> 
     43  </Doc12> 
    4144 </DocsAndViews> 
    4245 <pluginList> 
  • trunk/OpenYahtzee/src/MainFrame.cpp

    r34 r37  
    382382                ((wxTextCtrl*) FindWindow(event.GetId() - ID_ACES + ID_ACESTEXT))->SetValue(out); 
    383383                 
    384                 //now after the scoring reset the rolls 
    385                 ResetRolls(); 
    386                 //and disable the button 
    387                 FindWindow(event.GetId())->Enable(false); 
    388                 m_numofplaysleft--; 
    389                 EnableUndo(event.GetId()); 
    390                 EndofGame(); 
     384                PostScore(event.GetId()); 
    391385        } 
    392386        else  
     
    418412                ((wxTextCtrl*) FindWindow(ID_THREEOFAKINDTEXT))->SetValue(wxT("0")); 
    419413         
    420         //now after the scoring reset the rolls 
    421         ResetRolls(); 
    422         //and disable the button 
    423         FindWindow(event.GetId())->Enable(false); 
    424         m_numofplaysleft--; 
    425         EnableUndo(event.GetId()); 
    426         EndofGame(); 
     414        PostScore(event.GetId()); 
    427415} 
    428416 
     
    451439                ((wxTextCtrl*) FindWindow(ID_FOUROFAKINDTEXT))->SetValue(wxT("0")); 
    452440         
    453         //now after the scoring reset the rolls 
    454         ResetRolls(); 
    455         //and disable the button 
    456         FindWindow(event.GetId())->Enable(false); 
    457         m_numofplaysleft--; 
    458         EnableUndo(event.GetId()); 
    459         EndofGame(); 
     441        PostScore(event.GetId()); 
    460442} 
    461443 
     
    482464                ((wxTextCtrl*) FindWindow(ID_FULLHOUSETEXT))->SetValue(wxT("0")); 
    483465         
    484         //now after the scoring reset the rolls 
    485         ResetRolls(); 
    486         //and disable the button 
    487         FindWindow(event.GetId())->Enable(false); 
    488         m_numofplaysleft--; 
    489         EnableUndo(event.GetId()); 
    490         EndofGame(); 
     466        PostScore(event.GetId()); 
    491467} 
    492468 
     
    510486                ((wxTextCtrl*) FindWindow(ID_SMALLSEQUENCETEXT))->SetValue(wxT("0")); 
    511487         
    512         //now after the scoring reset the rolls 
    513         ResetRolls(); 
    514         //and disable the button 
    515         FindWindow(event.GetId())->Enable(false); 
    516         m_numofplaysleft--; 
    517         EnableUndo(event.GetId()); 
    518         EndofGame(); 
     488        PostScore(event.GetId()); 
    519489} 
    520490 
     
    537507                ((wxTextCtrl*) FindWindow(ID_LARGESEQUENCETEXT))->SetValue(wxT("0")); 
    538508         
    539         //now after the scoring reset the rolls 
    540         ResetRolls(); 
    541         //and disable the button 
    542         FindWindow(event.GetId())->Enable(false); 
    543         m_numofplaysleft--; 
    544         EnableUndo(event.GetId()); 
    545         EndofGame(); 
     509        PostScore(event.GetId()); 
    546510} 
    547511 
     
    559523                ((wxTextCtrl*) FindWindow(ID_YAHTZEETEXT))->SetValue(wxT("0")); 
    560524 
    561         FindWindow(event.GetId())->Enable(false); 
    562         m_numofplaysleft--; 
    563         ResetRolls(); 
    564         EnableUndo(event.GetId()); 
    565         EndofGame(); 
     525        PostScore(event.GetId()); 
    566526} 
    567527 
     
    578538                ((wxTextCtrl*) FindWindow(ID_CHANCETEXT))->SetValue(out); 
    579539                 
    580                 //now after the scoring reset the rolls 
    581                 ResetRolls(); 
    582                 //and disable the button 
    583                 FindWindow(event.GetId())->Enable(false); 
    584                 m_numofplaysleft--; 
    585                 EnableUndo(event.GetId()); 
    586                 EndofGame(); 
     540                PostScore(event.GetId()); 
    587541        } 
    588542        else  
     
    712666 
    713667} 
     668 
     669///this function handles all the post scoring stuff such as disabling the right button. 
     670void MainFrame::PostScore(int id) 
     671{ 
     672        //now after the scoring reset the rolls 
     673        ResetRolls(); 
     674 
     675        //and disable the button 
     676        FindWindow(id)->Enable(false); 
     677        m_numofplaysleft--; 
     678        EnableUndo(id); 
     679        EndofGame(); 
     680} 
  • trunk/OpenYahtzee/src/MainFrame.h

    r20 r37  
    7070        void HighScoreHandler(int score); 
    7171        inline void EnableUndo(int id); 
     72        void PostScore(int id); 
    7273 
    7374        //pointers to hold bitmap data for the dices 
Note: See TracChangeset for help on using the changeset viewer.