Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 7, 2018, 9:48:58 PM (6 years ago)
Author:
landauf
Message:

[Highscore_HS16] moved logic to compare old an new score to Highscore; fixed formatting in Gametypes

Location:
code/trunk/src/orxonox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/Highscore.cc

    r11715 r11716  
    5050
    5151    /**
    52      * @brief stores a new highscore in the orxonox.ini file
     52     * @brief stores a new highscore in the orxonox.ini file if the new score is better than the highest score so far.
    5353     */
    54     void Highscore::storeHighscore(const std::string& level, int points, PlayerInfo* player){
    55         ModifyConfigValue(highscores_, add, player->getName() + "./." + level + "./." + multi_cast<std::string>(points));
     54    void Highscore::storeScore(const std::string& level, int points, PlayerInfo* player){
     55        if (points > this->getHighestScoreOfGame(level)) {
     56            ModifyConfigValue(highscores_, add, player->getName() + "./." + level + "./." + multi_cast<std::string>(points));
     57        }
    5658    }
    5759}
  • code/trunk/src/orxonox/Highscore.h

    r11715 r11716  
    1818        void setConfigValues(); // Inherited function
    1919
    20         void storeHighscore(const std::string& level, int points, PlayerInfo* player);
     20        void storeScore(const std::string& level, int points, PlayerInfo* player);
    2121        int getHighestScoreOfGame(const std::string& game);
    2222
Note: See TracChangeset for help on using the changeset viewer.