Changeset 7638
- Timestamp:
- Nov 11, 2010, 11:21:28 AM (14 years ago)
- Location:
- code/branches/releasetodo/src/orxonox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/releasetodo/src/orxonox/LevelInfo.cc
r7626 r7638 42 42 43 43 // LevelInfoItem 44 45 //! The list of allowed tags. 46 /*static*/ std::set<std::string> LevelInfoItem::possibleTags_s = std::set<std::string>(); 44 47 45 48 /** … … 73 76 { 74 77 78 } 79 80 void LevelInfoItem::initializeTags(void) 81 { 82 if(!LevelInfoItem::initialized_s) 83 { 84 LevelInfoItem::possibleTags_s.insert("test"); 85 LevelInfoItem::possibleTags_s.insert("singleplayer"); 86 LevelInfoItem::possibleTags_s.insert("multiplayer"); 87 LevelInfoItem::possibleTags_s.insert("showcase"); 88 LevelInfoItem::possibleTags_s.insert("tutorial"); 89 } 75 90 } 76 91 … … 103 118 bool LevelInfoItem::addTag(const std::string& tag, bool update) 104 119 { 120 if(!this->validateTag(tag)) 121 { 122 COUT(2) << "Bad tag '" << tag << "' in " << this->getXMLFilename() << ". Ignoring..." << std::endl; 123 return false; 124 } 105 125 bool success = this->tags_.insert(std::string(tag)).second; 106 126 if(update && success) -
code/branches/releasetodo/src/orxonox/LevelInfo.h
r7626 r7638 38 38 #include "OrxonoxPrereqs.h" 39 39 40 #include <map> 40 41 #include <set> 41 42 #include <string> … … 120 121 private: 121 122 void tagsUpdated(void); //!< Updates the comma-seperated string of all tags, if the set of tags has changed. 123 124 static std::set<std::string> possibleTags_s; 125 static const bool initialized_s = false; 126 void initializeTags(void); 127 bool validateTag(const std::string& tag) 128 { this->initializeTags(); return LevelInfoItem::possibleTags_s.find(tag) != LevelInfoItem::possibleTags_s.end(); } 122 129 123 130 std::string name_; //!< The name of the Level.
Note: See TracChangeset
for help on using the changeset viewer.