Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 1, 2016, 3:08:54 PM (7 years ago)
Author:
kappenh
Message:

updated Highscore interface and Jump save routine TODO Menu!

File:
1 edited

Legend:

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

    r11313 r11315  
    2020    void Highscore::setConfigValues()
    2121    {
     22        SetConfigValue(highscores_, std::vector<std::string>()).description("HighscoreVektor");
     23    }
    2224
    23                 SetConfigValue(name_, "Test").description("The name of the game");
    24         SetConfigValue(tests_, std::vector<std::string>()).description("Testvektor");
     25    int Highscore::getHighestScoreOfGame(std::string game){
     26        std::string delimiter = "./.";
     27        int best = -1;
     28        for (std::string score : this->highscores_)
     29        {
     30           
     31            score.erase(0, score.find(delimiter) + delimiter.length());
     32            if(game.compare(score.substr(0,score.find(delimiter))) == 0){
     33                score.erase(0, score.find(delimiter) + delimiter.length());
     34                int possibleBest = std::stoi(score);
     35                if(possibleBest > best) best = possibleBest;
     36            }
     37
     38
     39        }
     40       
     41        return best;
     42       
    2543    }
     44
    2645    void Highscore::storeHighscore(std::string player, std::string level, int points){
    27         ModifyConfigValue(tests_, add, player+"./."+level+"./."+std::to_string(points));
     46        ModifyConfigValue(highscores_, add, player+"./."+level+"./."+std::to_string(points));
    2847    }
    2948    /* static std::string Highscore::getName(){
Note: See TracChangeset for help on using the changeset viewer.