Changeset 161


Ignore:
Timestamp:
09/27/2008 11:55:54 AM (3 years ago)
Author:
guyru
Message:

get const pointer to the highscorelist inside Configuration

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/configuration.cpp

    r160 r161  
    158158void Configuration::saveHighscores(ofstream *file) 
    159159{ 
    160         HighscoreList::iterator it; 
     160        HighscoresList::iterator it; 
    161161        for (it = m_highscores.begin(); it!=m_highscores.end(); it++) { 
    162162                (*file)<<(*it).score<<" "; 
     
    285285        } 
    286286 
    287         HighscoreList::iterator it= m_highscores.end(); 
     287        HighscoresList::iterator it= m_highscores.end(); 
    288288        if ((--it)->score<score) { 
    289289                return true; 
     
    306306        temp_item.name = name; 
    307307 
    308         HighscoreList::iterator it = m_highscores.begin(); 
     308        HighscoresList::iterator it = m_highscores.begin(); 
    309309        while (it!=m_highscores.end()) { 
    310310                if (it->score < temp_item.score) { 
     
    326326        return place; 
    327327} 
     328 
     329const HighscoresList* Configuration::getHighscores() const 
     330{ 
     331        const HighscoresList * ptr = &m_highscores; 
     332        return ptr; 
     333} 
  • trunk/src/configuration.h

    r160 r161  
    3232struct HighscoreItem; 
    3333 
    34 typedef std::list<HighscoreItem> HighscoreList; 
     34typedef std::list<HighscoreItem> HighscoresList; 
    3535 
    3636static const char* DEFAULT_HIGHSCORE_SIZE = "20"; 
     
    6262        Configuration *set(std::string key, std::string value); 
    6363 
     64        /** 
     65         * Checks if a given score quallifies to the high score list 
     66         */ 
    6467        bool isHighscore(int score); 
     68         
     69        /** 
     70         * Adds a given entry to the highscore list. 
     71         * \return the place in the highscore list for the new entry, or 
     72         * zero if it didn't quallify. 
     73         */ 
    6574        int submitHighscore(int score, std::string name, std::string date); 
     75 
     76        const HighscoresList* getHighscores() const; 
    6677private: 
    6778        /** 
     
    8293         
    8394        std::map<std::string, std::string> m_settings; 
    84         HighscoreList m_highscores; 
     95        HighscoresList m_highscores; 
    8596 
    8697        std::string m_file; 
Note: See TracChangeset for help on using the changeset viewer.