Changeset 166 for trunk/src/MainFrame.cpp
- Timestamp:
- 10/01/2008 06:37:24 AM (4 years ago)
- File:
-
- 1 edited
-
trunk/src/MainFrame.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MainFrame.cpp
r165 r166 41 41 #include <cstdlib> 42 42 #include <wx/version.h> 43 #include <wx/filename.h> 43 44 44 45 //include the icon file … … 91 92 m_config = new configuration::Configuration(config_file); 92 93 93 m_highscoredb = new HighScoreTableDB();94 95 94 m_evt_handler = new MainFrameEvtHandler(this); 96 95 97 InitializeDatabase();//this must come _after_ m_settingsdb and m_highscoredb are created98 99 96 //bitmap_dices[0] = new wxBitmap(one_xpm); 100 97 //bitmap_dices[1] = new wxBitmap(two_xpm); … … 1001 998 wxCommandEvent newevent; 1002 999 1003 1004 place = m_highscoredb->IsHighScore(score); 1005 1006 if(!place) //if the score didn't make it to the highscore table do nothing 1007 return; 1000 1001 if(!m_config->isHighscore(score)) { 1002 return; 1003 } 1008 1004 1009 1005 wxString msg; 1010 msg.Printf(wxT("Your score made it to the high score table. Your place is number %i.\nPlease enter your name below:"),place); 1011 1012 wxTextEntryDialog infodialog(this,msg,wxT("Please enter your name"),wxT(""),wxOK | wxCENTRE); 1006 msg.Printf(wxT("Your score made it to the high score table.\nPlease enter your name below:"),place); 1007 1008 wxString last_name = wxString::FromUTF8(m_config->get("last-name").c_str()); 1009 1010 wxTextEntryDialog infodialog(this,msg,wxT("Please enter your name"),last_name ,wxOK | wxCENTRE); 1013 1011 infodialog.ShowModal(); 1014 1012 … … 1017 1015 //get the date 1018 1016 wxDateTime now = wxDateTime::Now(); 1019 date = now.Format ISOTime().mb_str();1020 date += " ";1021 date += now.Format Date().mb_str();1022 1023 m_highscoredb->SendHighScore(name,date,score);1017 date = now.FormatDate().mb_str(); 1018 date += " "; 1019 date += now.FormatISOTime().SubString(0,5).mb_str(); 1020 1021 int rank = m_config->submitHighscore(score, name, date); 1024 1022 1025 1023 //now show the high score table 1026 newevent.SetId(ID_SHOWHIGHSCORE); 1027 newevent.SetEventType(wxEVT_COMMAND_MENU_SELECTED); 1028 ProcessEvent(newevent); 1024 highscores_dialog::HighscoresDialog *dialog = new highscores_dialog::HighscoresDialog(this,m_config,rank); 1025 1026 dialog->ShowModal(); 1027 1028 delete dialog; 1029 1029 1030 1030 } … … 1091 1091 } 1092 1092 1093 1094 ///TODO: delete this function1095 /**1096 * Initializes the database and stores default settings if needed.1097 * @return 0 if some error1098 */1099 int MainFrame::InitializeDatabase()1100 {1101 1102 int highscoresize = atoi((m_config->get("highscore-list-size")).c_str());1103 m_highscoredb->SetSize(highscoresize);1104 1105 return 1;1106 }1107 1093 1108 1094 void MainFrame::Relayout() … … 1350 1336 // free pointers 1351 1337 delete m_config; 1352 delete m_highscoredb;1353 1338 delete m_evt_handler; 1354 1339 }
Note: See TracChangeset
for help on using the changeset viewer.
