Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 12, 2016, 3:28:37 PM (7 years ago)
Author:
kappenh
Message:

Finished Project

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Highscore_HS16/src/orxonox/Highscore.cc

    r11315 r11333  
    1717        this->setConfigValues();
    1818    }
    19 
     19    /**
     20     * @brief set the config values in the orxonox.ini file
     21     */
    2022    void Highscore::setConfigValues()
    2123    {
    22         SetConfigValue(highscores_, std::vector<std::string>()).description("HighscoreVektor");
     24        SetConfigValue(highscores_, std::vector<std::string>()).description("Highscores saved as vector");
     25        SetConfigValue(playerName_, "Player").description("Name of the player");
    2326    }
    24 
     27    /**
     28     * @brief Returns highest score of given game, if exists.
     29     * Else returns -1.
     30     */
    2531    int Highscore::getHighestScoreOfGame(std::string game){
    26         std::string delimiter = "./.";
     32        std::string delimiter = "./."; //score save as "Playername./.game./.score"
    2733        int best = -1;
     34        //check for the highest Score of given game
    2835        for (std::string score : this->highscores_)
    2936        {
    30            
     37            //filter the game string from given highscore
    3138            score.erase(0, score.find(delimiter) + delimiter.length());
    3239            if(game.compare(score.substr(0,score.find(delimiter))) == 0){
     
    4249       
    4350    }
    44 
    45     void Highscore::storeHighscore(std::string player, std::string level, int points){
    46         ModifyConfigValue(highscores_, add, player+"./."+level+"./."+std::to_string(points));
     51    /**
     52     * @brief stores a new highscore in the orxonox.ini file
     53     */
     54    void Highscore::storeHighscore(std::string level, int points){
     55        ModifyConfigValue(highscores_, add, playerName_+"./."+level+"./."+std::to_string(points));
    4756    }
    48     /* static std::string Highscore::getName(){
    49         std::string result;
    50         result = Highscore::name_;
    51         return result;
    52     }*/
     57   
    5358}
Note: See TracChangeset for help on using the changeset viewer.