Changeset 7552 for code/trunk/src/modules/questsystem/Quest.cc
- Timestamp:
- Oct 17, 2010, 10:50:43 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/questsystem/Quest.cc
r7456 r7552 92 92 bool Quest::setParentQuest(Quest* quest) 93 93 { 94 //TODO: Replace with assert. 95 if(quest == NULL) // We don't want to set NULL-Pointers. 96 { 97 COUT(2) << "The parentquest to be added to quest {" << this->getId() << "} was NULL." << std::endl; 98 return false; 99 } 94 assert(quest); 100 95 101 96 this->parentQuest_ = quest; … … 115 110 bool Quest::addSubQuest(Quest* quest) 116 111 { 117 //TODO: Replace with assert. 118 if(quest == NULL) // We don't want to set NULL-Pointers. 119 { 120 COUT(2) << "The subquest to be added to quest {" << this->getId() << "} was NULL." << std::endl; 121 return false; 122 } 112 assert(quest); 123 113 124 114 quest->setParentQuest(this); // Sets the currentQuest (this) as parent-quest for the added sub-quest. … … 140 130 bool Quest::addHint(QuestHint* hint) 141 131 { 142 //TODO: Replace with assert. 143 if(hint == NULL) // We don't want to set NULL-Pointers. Seriously! 144 { 145 COUT(2) << "A NULL-QuestHint was trying to be added." << std::endl; 146 return false; 147 } 132 assert(hint); 148 133 149 134 hint->setQuest(this); // Sets the current Quest (this) as Quest for the added QuestHint. … … 164 149 bool Quest::addFailEffect(QuestEffect* effect) 165 150 { 166 //TODO: Replace with assert. 167 if(effect == NULL) // We don't want to set NULL-Pointers. 168 { 169 COUT(2) << "A NULL-QuestEffect was trying to be added" << std::endl; 170 return false; 171 } 151 assert(effect); 172 152 173 153 this->failEffects_.push_back(effect); // Adds the QuestEffect to the end of the list of fail QuestEffects. … … 187 167 bool Quest::addCompleteEffect(QuestEffect* effect) 188 168 { 189 //TODO: Replace with assert. 190 if(effect == NULL) // We don't want to set NULL-Pointers. 191 { 192 COUT(2) << "A NULL-QuestEffect was trying to be added" << std::endl; 193 return false; 194 } 169 assert(effect); 195 170 196 171 this->completeEffects_.push_back(effect); // Adds the QuestEffect to the end of the list of complete QuestEffects. … … 300 275 @return 301 276 Returns true if the quest status for the specific player is 'inactive'. 302 @throws303 Throws an exception if getStatus throws one.304 277 */ 305 278 bool Quest::isInactive(const PlayerInfo* player) const 306 279 { 280 if(player == NULL) 281 return true; 307 282 return this->getStatus(player) == QuestStatus::Inactive; 308 283 } … … 315 290 @return 316 291 Returns true if the quest status for the specific player is 'active'. 317 @throws318 Throws an exception if getStatus throws one.319 292 */ 320 293 bool Quest::isActive(const PlayerInfo* player) const 321 294 { 295 if(player == NULL) 296 return false; 322 297 return this->getStatus(player) == QuestStatus::Active; 323 298 } … … 330 305 @return 331 306 Returns true if the quest status for the specific player is 'failed'. 332 @throws333 Throws an exception if getStatus throws one.334 307 */ 335 308 bool Quest::isFailed(const PlayerInfo* player) const 336 309 { 310 if(player == NULL) 311 return false; 337 312 return this->getStatus(player) == QuestStatus::Failed; 338 313 } … … 345 320 @return 346 321 Returns true if the quest status for the specific player is 'completed'. 347 @throws348 Throws an exception if getStatus throws one.349 322 */ 350 323 bool Quest::isCompleted(const PlayerInfo* player) const 351 324 { 325 if(player == NULL) 326 return false; 352 327 return this->getStatus(player) == QuestStatus::Completed; 353 328 } … … 427 402 bool Quest::addListener(QuestListener* listener) 428 403 { 429 //TODO: Replace with assert? 430 if(listener == NULL) 431 { 432 COUT(2) << "A NULL-QuestListener was trying to be added to a Quests listeners." << std::endl; 433 return false; 434 } 404 assert(listener); 435 405 436 406 this->listeners_.push_back(listener);
Note: See TracChangeset
for help on using the changeset viewer.