Changeset 11333 for code/branches/Highscore_HS16/src/orxonox
- Timestamp:
- Dec 12, 2016, 3:28:37 PM (8 years ago)
- 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 47 47 ADD_SUBDIRECTORY(gametypes) 48 48 ADD_SUBDIRECTORY(graphics) 49 ADD_SUBDIRECTORY(highscore)50 49 ADD_SUBDIRECTORY(infos) 51 50 ADD_SUBDIRECTORY(interfaces) -
code/branches/Highscore_HS16/src/orxonox/Highscore.cc
r11315 r11333 17 17 this->setConfigValues(); 18 18 } 19 19 /** 20 * @brief set the config values in the orxonox.ini file 21 */ 20 22 void Highscore::setConfigValues() 21 23 { 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"); 23 26 } 24 27 /** 28 * @brief Returns highest score of given game, if exists. 29 * Else returns -1. 30 */ 25 31 int Highscore::getHighestScoreOfGame(std::string game){ 26 std::string delimiter = "./."; 32 std::string delimiter = "./."; //score save as "Playername./.game./.score" 27 33 int best = -1; 34 //check for the highest Score of given game 28 35 for (std::string score : this->highscores_) 29 36 { 30 37 //filter the game string from given highscore 31 38 score.erase(0, score.find(delimiter) + delimiter.length()); 32 39 if(game.compare(score.substr(0,score.find(delimiter))) == 0){ … … 42 49 43 50 } 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)); 47 56 } 48 /* static std::string Highscore::getName(){ 49 std::string result; 50 result = Highscore::name_; 51 return result; 52 }*/ 57 53 58 } -
code/branches/Highscore_HS16/src/orxonox/Highscore.h
r11315 r11333 14 14 Highscore(); // Constructor 15 15 void setConfigValues(); // Inherited function 16 void storeHighscore(std::string player, std::stringlevel, int points);16 void storeHighscore(std::string level, int points); 17 17 18 18 int getHighestScoreOfGame(std::string game); … … 32 32 std::vector<std::string> highscores_; 33 33 float version_; 34 std::string playerName_; 34 35 static Highscore* singletonPtr_s; 35 36 }; //tolua_export
Note: See TracChangeset
for help on using the changeset viewer.