- Timestamp:
- Nov 7, 2016, 3:55:36 PM (8 years ago)
- Location:
- code/branches/Highscore_HS16
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Highscore_HS16/data/gui/scripts/HighscoreMenu.lua
r11265 r11267 38 38 P.createFilterTab(v:getName(), v:getName()) 39 39 end 40 local highscores = v:getHighscores() 41 orxonox.CommandExecutor:execute("log test:".. highscores) 42 40 43 end 41 44 --P.createFilterTab("Minigames", "minigame") -
code/branches/Highscore_HS16/src/orxonox/LevelInfo.cc
r11099 r11267 151 151 } 152 152 153 bool LevelInfoItem::addHighscore(const std::string& name, const int score) 154 { 155 std::stringstream stream; 156 stream << name << "/:/" << score; 157 bool success = this->highscores_.insert(stream.str()).second; 158 if(success) 159 this->highscoresUpdated(); 160 return success; 161 } 162 153 163 /** 154 164 @brief … … 191 201 } 192 202 203 void LevelInfoItem::highscoresUpdated(void) 204 { 205 std::stringstream stream; 206 std::set<std::string>::iterator temp; 207 for(std::set<std::string>::iterator it = this->highscores_.begin(); it != this->highscores_.end(); ) 208 { 209 temp = it; 210 if(++it == this->highscores_.end()) // If this is the last tag we don't add a comma. 211 stream << *temp; 212 else 213 stream << *temp << ", "; 214 } 215 216 this->highscoresString_ = std::string(stream.str()); 217 } 193 218 /** 194 219 @brief -
code/branches/Highscore_HS16/src/orxonox/LevelInfo.h
r11099 r11267 118 118 inline bool hasTag(const std::string& tag) const { return this->tags_.find(tag) != this->tags_.end(); } // tolua_export 119 119 120 bool addHighscore(const std::string& name,const int score); 121 122 inline const std::string& getHighscores(void) const { return this->highscoresString_; } // tolua_export 123 120 124 void setStartingShips(const std::string& ships); //!< Set the starting ship models of the level 121 125 bool addStartingShip(const std::string& ship, bool update = true); //!< Add a model to shipselection … … 154 158 void startingshipsUpdated(void); //!< Updates the comma-seperated string of all possible starting ships. 155 159 void tagsUpdated(void); //!< Updates the comma-seperated string of all tags, if the set of tags has changed. 160 void highscoresUpdated(void); 156 161 static void initializeTags(void); //!< Initialize the set of allowed tags. 157 162 /** … … 170 175 std::string screenshot_; //!< The screenshot of the Level. 171 176 std::set<std::string> tags_; //!< The set of tags the Level is tagged with. 177 178 std::set<std::string> highscores_; 179 std::string highscoresString_; 180 172 181 std::string tagsString_; //!< The comma-seperated string of all the tags the Level is tagged with. 173 182 std::set<std::string> startingShips_; //!< The set of starting ship models the Level allows. … … 244 253 inline const std::string& getTags(void) const 245 254 { return this->LevelInfoItem::getTags(); } 255 256 inline const std::string& getHighscores(void) const 257 { return this->LevelInfoItem::getHighscores(); } 246 258 /** 247 259 @brief Set the starting ship models of the level
Note: See TracChangeset
for help on using the changeset viewer.