- Timestamp:
- Nov 8, 2008, 7:58:49 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem2/src/orxonox/objects/quest/QuestManager.cc
r2105 r2159 27 27 */ 28 28 29 /** 30 @file QuestManager.cc 31 @brief 32 Implementation of the QuestManager class. 33 */ 34 29 35 #include "OrxonoxStableHeaders.h" 30 36 #include "QuestManager.h" … … 38 44 namespace orxonox { 39 45 40 std::map<std::string, Quest*> QuestManager::questMap_; 41 std::map<std::string, QuestHint*> QuestManager::hintMap_; 42 46 //! All quests registered by their id's. 47 std::map<std::string, Quest*> QuestManager::questMap_s; 48 //! All hints registered by their id's. 49 std::map<std::string, QuestHint*> QuestManager::hintMap_s; 50 51 /** 52 @brief 53 Constructor. Registers the object. 54 */ 43 55 QuestManager::QuestManager(BaseObject* creator) : BaseObject(creator) 44 56 { … … 46 58 } 47 59 48 60 /** 61 @brief 62 Destructor. 63 */ 49 64 QuestManager::~QuestManager() 50 65 { … … 55 70 @brief 56 71 Registers a quest with the QuestManager to make it globally accessable. 72 Uses it's id to make sure to be able to be identify and retrieve it later. 57 73 @param quest 58 74 The quest that is to be registered. … … 62 78 bool QuestManager::registerQuest(Quest* quest) 63 79 { 64 if(quest == NULL) 80 if(quest == NULL) //!< Doh! Just as if there were actual quests behind NULL-pointers. 65 81 { 66 82 COUT(2) << "Registration of Quest in QuestManager failed, because inserted Quest-pointer was NULL." << std::endl; … … 68 84 } 69 85 70 std::pair<std::map<std::string, Quest*>::iterator,bool> re t;71 re t = questMap_.insert( std::pair<std::string,Quest*>(quest->getId(),quest) );72 73 if(re t.second)86 std::pair<std::map<std::string, Quest*>::iterator,bool> result; 87 result = questMap_s.insert( std::pair<std::string,Quest*>(quest->getId(),quest) ); //!< Inserting the quest. 88 89 if(result.second) //!< If inserting was a success. 74 90 { 75 91 COUT(3) << "Quest with questId {" << quest->getId() << "} successfully inserted." << std::endl; … … 86 102 @brief 87 103 Registers a QuestHint with the QuestManager to make it globally accessable. 104 Uses it's id to make sure to be able to be identify and retrieve it later. 88 105 @param hint 89 106 The QuestHint to be registered. … … 93 110 bool QuestManager::registerHint(QuestHint* hint) 94 111 { 95 if(hint == NULL) 112 if(hint == NULL) //!< Still not liking NULL-pointers. 96 113 { 97 114 COUT(2) << "Registration of QuestHint in QuestManager failed, because inserted QuestHint-pointer was NULL." << std::endl; … … 99 116 } 100 117 101 std::pair<std::map<std::string, QuestHint*>::iterator,bool> re t;102 re t = hintMap_.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) );103 104 if(re t.second)118 std::pair<std::map<std::string, QuestHint*>::iterator,bool> result; 119 result = hintMap_s.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) ); //!< Inserting the hint. 120 121 if(result.second) //!< If inserting was a success. 105 122 { 106 123 COUT(3) << "QuestHint with hintId {" << hint->getId() << "} successfully inserted." << std::endl; … … 127 144 Quest* QuestManager::findQuest(const std::string & questId) 128 145 { 129 if(!QuestItem::isId(questId)) 146 if(!QuestItem::isId(questId)) //!< Check vor validity of the given id. 130 147 { 131 148 ThrowException(Argument, "Invalid questId."); … … 133 150 134 151 Quest* quest; 135 std::map<std::string, Quest*>::iterator it = questMap_ .find(questId);136 if (it != questMap_ .end())152 std::map<std::string, Quest*>::iterator it = questMap_s.find(questId); 153 if (it != questMap_s.end()) //!< If the quest is registered. 137 154 { 138 155 quest = it->second; … … 161 178 QuestHint* QuestManager::findHint(const std::string & hintId) 162 179 { 163 if(!QuestItem::isId(hintId)) 180 if(!QuestItem::isId(hintId)) //!< Check vor validity of the given id. 164 181 { 165 182 ThrowException(Argument, "Invalid hintId."); … … 167 184 168 185 QuestHint* hint; 169 std::map<std::string, QuestHint*>::iterator it = hintMap_ .find(hintId);170 if (it != hintMap_ .end())186 std::map<std::string, QuestHint*>::iterator it = hintMap_s.find(hintId); 187 if (it != hintMap_s.end()) //!< If the hint is registered. 171 188 { 172 189 hint = it->second;
Note: See TracChangeset
for help on using the changeset viewer.