Ignore:
Timestamp:
10/01/2008 06:37:24 AM (4 years ago)
Author:
guyru
Message:

remove the code of the HighScoreTableDB

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MainFrame.cpp

    r165 r166  
    4141#include <cstdlib> 
    4242#include <wx/version.h> 
     43#include <wx/filename.h> 
    4344 
    4445//include the icon file 
     
    9192        m_config = new configuration::Configuration(config_file); 
    9293 
    93         m_highscoredb = new HighScoreTableDB(); 
    94  
    9594        m_evt_handler = new MainFrameEvtHandler(this); 
    9695         
    97         InitializeDatabase();//this must come _after_ m_settingsdb and m_highscoredb are created 
    98  
    9996        //bitmap_dices[0] = new wxBitmap(one_xpm); 
    10097        //bitmap_dices[1] = new wxBitmap(two_xpm); 
     
    1001998        wxCommandEvent newevent; 
    1002999 
    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        } 
    10081004         
    10091005        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); 
    10131011        infodialog.ShowModal(); 
    10141012 
     
    10171015        //get the date 
    10181016        wxDateTime now = wxDateTime::Now(); 
    1019         date = now.FormatISOTime().mb_str(); 
    1020         date +=" "; 
    1021         date += now.FormatDate().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); 
    10241022 
    10251023        //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; 
    10291029 
    10301030} 
     
    10911091} 
    10921092 
    1093  
    1094 ///TODO: delete this function 
    1095 /** 
    1096  * Initializes the database and stores default settings if needed. 
    1097  * @return 0 if some error 
    1098  */ 
    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 } 
    11071093 
    11081094void MainFrame::Relayout() 
     
    13501336        // free pointers 
    13511337        delete m_config; 
    1352         delete m_highscoredb; 
    13531338        delete m_evt_handler; 
    13541339} 
Note: See TracChangeset for help on using the changeset viewer.