Changeset 2068 for code/branches/questsystem/src/orxonox/objects/Quest.cc
- Timestamp:
- Oct 30, 2008, 9:52:12 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem/src/orxonox/objects/Quest.cc
r2021 r2068 30 30 31 31 #include "Quest.h" 32 #include "QuestManager.h" 32 33 33 34 namespace orxonox { … … 35 36 Quest::Quest() : QuestItem() 36 37 { 37 38 this->initialize(); 38 39 } 39 40 … … 48 49 The description of the quest. 49 50 */ 50 Quest::Quest(std::string id , std::string title, std::string description) : QuestItem(id, title, description)51 { 52 initialize();51 Quest::Quest(std::string id) : QuestItem(id) 52 { 53 this->initialize(); 53 54 } 54 55 … … 59 60 Quest::~Quest() 60 61 { 61 //TDO: Unload lists...62 62 63 } 63 64 … … 70 71 RegisterObject(Quest); 71 72 72 this->parentQuest_ = 0; 73 this->parentQuest_ = NULL; 74 QuestManager::registerQuest(this); //Registers the quest with the QuestManager. 73 75 } 74 76 … … 78 80 @param quest 79 81 A pointer to the quest to be set as parent quest. 82 @return 83 Returns true if the parentQuest could be set. 80 84 */ 81 85 bool Quest::setParentQuest(Quest* quest) 82 86 { 87 if(quest == NULL) 88 { 89 COUT(2) << "The parentquest to be added to quest {" << this->getId() << "} was NULL." << std::endl; 90 return false; 91 } 92 83 93 this->parentQuest_ = quest; 84 94 return true; … … 90 100 @param quest 91 101 A pointer to the quest to be set as sub quest. 102 @return 103 Returns true if the subQuest vould be set. 92 104 */ 93 105 bool Quest::addSubQuest(Quest* quest) 94 106 { 107 if(quest == NULL) 108 { 109 COUT(2) << "The subquest to be added to quest {" << this->getId() << "} was NULL." << std::endl; 110 return false; 111 } 112 95 113 this->subQuests_.push_back(quest); 96 114 return true; 115 } 116 117 /** 118 @brief 119 Returns true if the quest status for the specific player is 'inactive'. 120 @param player 121 The player. 122 @return 123 Returns true if the quest status for the specific player is 'inactive'. 124 @throws 125 Throws an exception if getStatus throws one. 126 */ 127 bool Quest::isInactive(const Player* player) const 128 { 129 return this->getStatus(player) == questStatus::inactive; 130 } 131 132 /** 133 @brief 134 Returns true if the quest status for the specific player is 'active'. 135 @param player 136 The player. 137 @return 138 Returns true if the quest status for the specific player is 'active'. 139 @throws 140 Throws an exception if getStatus throws one. 141 */ 142 bool Quest::isActive(const Player* player) const 143 { 144 145 return this->getStatus(player) == questStatus::active; 146 } 147 148 /** 149 @brief 150 Returns true if the quest status for the specific player is 'failed'. 151 @param player 152 The player. 153 @return 154 Returns true if the quest status for the specific player is 'failed'. 155 @throws 156 Throws an exception if getStatus throws one. 157 */ 158 bool Quest::isFailed(const Player* player) const 159 { 160 return this->getStatus(player) == questStatus::failed; 161 } 162 163 /** 164 @brief 165 Returns true if the quest status for the specific player is 'completed'. 166 @param player 167 The player. 168 @return 169 Returns true if the quest status for the specific player is 'completed'. 170 @throws 171 Throws an exception if getStatus throws one. 172 */ 173 bool Quest::isCompleted(const Player* player) const 174 { 175 return this->getStatus(player) == questStatus::completed; 97 176 } 98 177 … … 102 181 @param hint 103 182 The hint that should be added to the list of hints. 104 */ 105 void Quest::addHint(QuestHint* hint) 106 { 107 if ( hint != NULL ) 108 { 109 this->hints_.push_back(hint); 110 hint->setQuest(this); 111 } 112 else 183 @return 184 Returns true if the hint was successfully added. 185 */ 186 bool Quest::addHint(QuestHint* hint) 187 { 188 if(hint == NULL) 113 189 { 114 190 COUT(2) << "A NULL-QuestHint was trying to be added." << std::endl; 115 } 191 return false; 192 } 193 194 this->hints_.push_back(hint); 195 hint->setQuest(this); 196 return true; 116 197 } 117 198
Note: See TracChangeset
for help on using the changeset viewer.