Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Finished Project

Location:
code/branches/Highscore_HS16/src/orxonox
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Highscore_HS16/src/orxonox/CMakeLists.txt

    r11313 r11333  
    4747ADD_SUBDIRECTORY(gametypes)
    4848ADD_SUBDIRECTORY(graphics)
    49 ADD_SUBDIRECTORY(highscore)
    5049ADD_SUBDIRECTORY(infos)
    5150ADD_SUBDIRECTORY(interfaces)
  • 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}
  • code/branches/Highscore_HS16/src/orxonox/Highscore.h

    r11315 r11333  
    1414        Highscore();              // Constructor
    1515        void setConfigValues(); // Inherited function
    16         void storeHighscore(std::string player, std::string level, int points);
     16        void storeHighscore(std::string level, int points);
    1717
    1818        int getHighestScoreOfGame(std::string game);
     
    3232        std::vector<std::string> highscores_;
    3333        float version_;
     34        std::string playerName_;
    3435        static Highscore* singletonPtr_s;
    3536}; //tolua_export
Note: See TracChangeset for help on using the changeset viewer.