Changeset 166 for trunk


Ignore:
Timestamp:
01/10/08 06:37:24 (6 years ago)
Author:
guyru
Message:

remove the code of the HighScoreTableDB

Location:
trunk/src
Files:
2 deleted
4 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} 
  • trunk/src/MainFrame.h

    r164 r166  
    2525*/ 
    2626 
    27 #include "HighScoreTableDB.h" 
    2827#include "ScoreDice.h" 
    2928#include "dice_graphics.h" 
     
    8887        void PostScore(int id); 
    8988        void CalculateSubTotal(); 
    90         int InitializeDatabase(); 
    9189        void Relayout(); 
    9290        void AddMenus(); 
     
    109107        short int m_rollsundo; //holds the number of remaining rolls for use with the undo option 
    110108 
    111         HighScoreTableDB *m_highscoredb; //handles the highscore database managment 
    112          
    113109        bool m_skiproll; ///used to prevent the user from accidently rolling the dice twice 
    114110 
  • trunk/src/Makefile.am

    r165 r166  
    1010        highscores_dialog.cpp \ 
    1111        highscores_dialog.h \ 
    12         HighScoreTableDB.cpp \ 
    1312        icon.xpm \ 
    1413        icon32.xpm \ 
     
    5049        dice_graphics.h \ 
    5150        dice_theme_dialog.h \ 
    52         HighScoreTableDB.h \ 
    5351        Icon.h \ 
    5452        icon32.ico \ 
  • trunk/src/highscores_dialog.cpp

    r165 r166  
    4545void HighscoresDialog::createControls() 
    4646{ 
    47         highscoreslist = new wxListCtrl(this,wxID_ANY,wxDefaultPosition,wxSize(400,400),wxLC_REPORT); 
     47        highscoreslist = new wxListCtrl(this,wxID_ANY,wxDefaultPosition,wxSize(400,400),wxLC_REPORT | wxBORDER_SUNKEN ); 
    4848 
    4949        wxListItem itemCol; 
Note: See TracChangeset for help on using the changeset viewer.