- Timestamp:
- Dec 23, 2008, 10:40:38 PM (16 years ago)
- Location:
- code/branches/bugger
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/bugger
- Property svn:mergeinfo changed
/code/branches/questsystem2 (added) merged: 2109,2146,2159,2191,2193-2196,2205-2206,2208-2209,2221,2226,2228,2251,2258
- Property svn:mergeinfo changed
-
code/branches/bugger/src/orxonox/objects/quest/QuestManager.cc
- Property svn:mergeinfo changed
/code/branches/questsystem2/src/orxonox/objects/quest/QuestManager.cc (added) merged: 2159,2191,2251 /code/trunk/src/orxonox/objects/quest/QuestManager.cc merged: 1925-2089
r2105 r2530 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 QuestHints 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 { … … 54 69 /** 55 70 @brief 56 Registers a quest with the QuestManager to make it globally accessable. 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 The quest that is to be registered.74 The Quest that is to be registered. 59 75 @return 60 76 Returns true if successful, false if not. … … 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 QuestHSint. 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; … … 116 133 /** 117 134 @brief 118 Finds a quest with the given id.135 Finds a Quest with the given id. 119 136 @param questId 120 The id of the quest sought for.121 @return 122 Returns a reference to the quest with the input id.123 Returns NULL if there is no quest with the given questId.137 The id of the Quest sought for. 138 @return 139 Returns a pointer to the Quest with the input id. 140 Returns NULL if there is no Quest with the given questId. 124 141 @throws 125 142 Throws an exception if the given questId is invalid. … … 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; … … 150 167 /** 151 168 @brief 152 Finds a hint with the given id.169 Finds a QuestHint with the given id. 153 170 @param hintId 154 The id of the hint sought for.155 @return 156 Returns a reference to the hint with the input id.157 Returns NULL if there is no hint with the given hintId.171 The id of the QuestHint sought for. 172 @return 173 Returns a pointer to the QuestHint with the input id. 174 Returns NULL if there is no QuestHint with the given hintId. 158 175 @throws 159 176 Throws an exception if the given hintId is invalid. … … 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 QuestHint is registered. 171 188 { 172 189 hint = it->second; - Property svn:mergeinfo changed
Note: See TracChangeset
for help on using the changeset viewer.