Changeset 11716
- Timestamp:
- Jan 7, 2018, 9:48:58 PM (7 years ago)
- Location:
- code/trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/dodgerace/DodgeRace.cc
r11715 r11716 225 225 // It will misteriously crash the game! 226 226 // Instead startMainMenu, this won't crash. 227 if (Highscore::exists()){ 228 int score = this->getPoints(); 229 if(score > Highscore::getInstance().getHighestScoreOfGame("Dodge Race")) 230 Highscore::getInstance().storeHighscore("Dodge Race",score,this->getPlayer()->getPlayer()); 231 232 } 227 if (Highscore::exists()) 228 { 229 int score = this->getPoints(); 230 Highscore::getInstance().storeScore("Dodge Race", score, this->getPlayer()->getPlayer()); 231 } 233 232 GSLevel::startMainMenu(); 234 233 } -
code/trunk/src/modules/invader/Invader.cc
r11715 r11716 189 189 // It will misteriously crash the game! 190 190 // Instead startMainMenu, this won't crash. 191 if (Highscore::exists()){ 192 int score = this->getPoints(); 193 if(score > Highscore::getInstance().getHighestScoreOfGame("Orxonox Arcade")) 194 Highscore::getInstance().storeHighscore("Orxonox Arcade",score,this->getPlayer()->getPlayer()); 195 196 } 191 if (Highscore::exists()) 192 { 193 int score = this->getPoints(); 194 Highscore::getInstance().storeScore("Orxonox Arcade", score, this->getPlayer()->getPlayer()); 195 } 197 196 GSLevel::startMainMenu(); 198 197 } -
code/trunk/src/modules/jump/Jump.cc
r11715 r11716 312 312 cleanup(); 313 313 GSLevel::startMainMenu(); 314 if (Highscore::exists()){ 315 int score = this->getScore(this->getPlayer()); 316 if(score > Highscore::getInstance().getHighestScoreOfGame("Jump")) 317 Highscore::getInstance().storeHighscore("Jump",score,this->getPlayer()); 318 319 } 314 if (Highscore::exists()) 315 { 316 int score = this->getScore(this->getPlayer()); 317 Highscore::getInstance().storeScore("Jump", score, this->getPlayer()); 318 } 320 319 Deathmatch::end(); 321 320 } -
code/trunk/src/modules/tetris/Tetris.cc
r11715 r11716 328 328 this->player_->stopControl(); 329 329 } 330 if (Highscore::exists()){ 331 int score = this->getScore(this->getPlayer()); 332 if(score > Highscore::getInstance().getHighestScoreOfGame("Tetris")) 333 Highscore::getInstance().storeHighscore("Tetris",score,this->getPlayer()); 334 335 } 330 if (Highscore::exists()) 331 { 332 int score = this->getScore(this->getPlayer()); 333 Highscore::getInstance().storeScore("Tetris", score, this->getPlayer()); 334 } 336 335 this->cleanup(); 337 336 -
code/trunk/src/modules/towerdefense/TowerDefense.cc
r11715 r11716 198 198 void TowerDefense::end() 199 199 { 200 if (Highscore::exists()){ 201 int score = this->getWaveNumber(); 202 if(score > Highscore::getInstance().getHighestScoreOfGame("Tower Defense")) 203 Highscore::getInstance().storeHighscore("Tower Defense",score,this->getPlayer()); 204 205 } 200 if (Highscore::exists()) 201 { 202 int score = this->getWaveNumber(); 203 Highscore::getInstance().storeScore("Tower Defense", score, this->getPlayer()); 204 } 206 205 TeamDeathmatch::end(); 207 206 ChatManager::message("Match is over! Gameover!"); -
code/trunk/src/orxonox/Highscore.cc
r11715 r11716 50 50 51 51 /** 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. 53 53 */ 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 } 56 58 } 57 59 } -
code/trunk/src/orxonox/Highscore.h
r11715 r11716 18 18 void setConfigValues(); // Inherited function 19 19 20 void store Highscore(const std::string& level, int points, PlayerInfo* player);20 void storeScore(const std::string& level, int points, PlayerInfo* player); 21 21 int getHighestScoreOfGame(const std::string& game); 22 22
Note: See TracChangeset
for help on using the changeset viewer.