Changeset 10765 for code/branches/cpp11_v2/src/modules/questsystem
- Timestamp:
- Nov 4, 2015, 10:25:42 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/modules/questsystem
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/modules/questsystem/GlobalQuest.cc
r9667 r10765 138 138 bool GlobalQuest::isStartable(const PlayerInfo* player) const 139 139 { 140 if(!(this->getParentQuest() == NULL|| this->getParentQuest()->isActive(player)))140 if(!(this->getParentQuest() == nullptr || this->getParentQuest()->isActive(player))) 141 141 return false; 142 142 … … 198 198 The status to be set. 199 199 @return 200 Returns false if player is NULL.200 Returns false if player is nullptr. 201 201 */ 202 202 bool GlobalQuest::setStatus(PlayerInfo* player, const QuestStatus::Value & status) … … 249 249 i--; 250 250 } 251 return NULL;251 return nullptr; 252 252 } 253 253 -
code/branches/cpp11_v2/src/modules/questsystem/LocalQuest.cc
r9667 r10765 128 128 bool LocalQuest::isStartable(const PlayerInfo* player) const 129 129 { 130 if(!(this->getParentQuest() == NULL|| this->getParentQuest()->isActive(player)))130 if(!(this->getParentQuest() == nullptr || this->getParentQuest()->isActive(player))) 131 131 return false; 132 132 … … 188 188 The status to be set. 189 189 @return 190 Returns false if player is NULL.190 Returns false if player is nullptr. 191 191 */ 192 192 bool LocalQuest::setStatus(PlayerInfo* player, const QuestStatus::Value & status) -
code/branches/cpp11_v2/src/modules/questsystem/Quest.cc
r10624 r10765 55 55 RegisterObject(Quest); 56 56 57 this->parentQuest_ = NULL;57 this->parentQuest_ = nullptr; 58 58 } 59 59 … … 183 183 The index. 184 184 @return 185 Returns a pointer to the sub-quest at the given index. NULLif there is no element at the given index.185 Returns a pointer to the sub-quest at the given index. nullptr if there is no element at the given index. 186 186 */ 187 187 const Quest* Quest::getSubQuest(unsigned int index) const … … 198 198 } 199 199 200 return NULL; // If the index is greater than the number of elements in the list.200 return nullptr; // If the index is greater than the number of elements in the list. 201 201 } 202 202 … … 207 207 The index. 208 208 @return 209 Returns a pointer to the QuestHint at the given index. NULLif there is no element at the given index.209 Returns a pointer to the QuestHint at the given index. nullptr if there is no element at the given index. 210 210 */ 211 211 const QuestHint* Quest::getHint(unsigned int index) const … … 221 221 i--; 222 222 } 223 return NULL; // If the index is greater than the number of elements in the list.223 return nullptr; // If the index is greater than the number of elements in the list. 224 224 } 225 225 … … 230 230 The index. 231 231 @return 232 Returns a pointer to the fail QuestEffect at the given index. NULLif there is no element at the given index.232 Returns a pointer to the fail QuestEffect at the given index. nullptr if there is no element at the given index. 233 233 */ 234 234 const QuestEffect* Quest::getFailEffect(unsigned int index) const … … 244 244 i--; 245 245 } 246 return NULL; // If the index is greater than the number of elements in the list.246 return nullptr; // If the index is greater than the number of elements in the list. 247 247 } 248 248 … … 253 253 The index. 254 254 @return 255 Returns a pointer to the complete QuestEffect at the given index. NULLif there is no element at the given index.255 Returns a pointer to the complete QuestEffect at the given index. nullptr if there is no element at the given index. 256 256 */ 257 257 const QuestEffect* Quest::getCompleteEffect(unsigned int index) const … … 267 267 i--; 268 268 } 269 return NULL; // If the index is greater than the number of elements in the list.269 return nullptr; // If the index is greater than the number of elements in the list. 270 270 } 271 271 … … 280 280 bool Quest::isInactive(const PlayerInfo* player) const 281 281 { 282 if(player == NULL)282 if(player == nullptr) 283 283 return true; 284 284 return this->getStatus(player) == QuestStatus::Inactive; … … 295 295 bool Quest::isActive(const PlayerInfo* player) const 296 296 { 297 if(player == NULL)297 if(player == nullptr) 298 298 return false; 299 299 return this->getStatus(player) == QuestStatus::Active; … … 310 310 bool Quest::isFailed(const PlayerInfo* player) const 311 311 { 312 if(player == NULL)312 if(player == nullptr) 313 313 return false; 314 314 return this->getStatus(player) == QuestStatus::Failed; … … 325 325 bool Quest::isCompleted(const PlayerInfo* player) const 326 326 { 327 if(player == NULL)327 if(player == nullptr) 328 328 return false; 329 329 return this->getStatus(player) == QuestStatus::Completed; -
code/branches/cpp11_v2/src/modules/questsystem/QuestEffectBeacon.cc
r9667 r10765 113 113 114 114 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 115 PlayerInfo* player = NULL;115 PlayerInfo* player = nullptr; 116 116 117 117 // If the trigger is a PlayerTrigger. 118 if(pTrigger != NULL)118 if(pTrigger != nullptr) 119 119 { 120 120 if(!pTrigger->isForPlayer()) // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one. … … 126 126 return false; 127 127 128 if(player == NULL)128 if(player == nullptr) 129 129 { 130 130 orxout(verbose, context::quests) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << endl; … … 243 243 i--; 244 244 } 245 return NULL;245 return nullptr; 246 246 } 247 247 -
code/branches/cpp11_v2/src/modules/questsystem/QuestHint.cc
r9667 r10765 88 88 bool QuestHint::isActive(const PlayerInfo* player) const 89 89 { 90 if(player == NULL) // If the player is NULL, the Quest obviously can't be active.90 if(player == nullptr) // If the player is nullptr, the Quest obviously can't be active. 91 91 return false; 92 92 -
code/branches/cpp11_v2/src/modules/questsystem/QuestListener.cc
r9667 r10765 59 59 60 60 this->mode_ = QuestListenerMode::All; 61 this->quest_ = NULL;61 this->quest_ = nullptr; 62 62 } 63 63 … … 81 81 XMLPortParam(QuestListener, "mode", setMode, getMode, xmlelement, mode); 82 82 83 if(this->quest_ != NULL)83 if(this->quest_ != nullptr) 84 84 this->quest_->addListener(this); // Adds the QuestListener to the Quests list of listeners. 85 85 … … 117 117 this->quest_ = QuestManager::getInstance().findQuest(id); // Find the Quest corresponding to the given questId. 118 118 119 if(this->quest_ == NULL) // If there is no such Quest.119 if(this->quest_ == nullptr) // If there is no such Quest. 120 120 { 121 121 ThrowException(Argument, "This is bad! The QuestListener has not found a Quest with a corresponding id.."); -
code/branches/cpp11_v2/src/modules/questsystem/QuestManager.cc
r10624 r10765 93 93 bool QuestManager::registerQuest(Quest* quest) 94 94 { 95 if(quest == NULL)96 { 97 orxout(internal_error, context::quests) << "Quest pointer is NULL." << endl;95 if(quest == nullptr) 96 { 97 orxout(internal_error, context::quests) << "Quest pointer is nullptr." << endl; 98 98 return false; 99 99 } … … 135 135 bool QuestManager::registerHint(QuestHint* hint) 136 136 { 137 if(hint == NULL)138 { 139 orxout(internal_error, context::quests) << "Quest pointer is NULL." << endl;137 if(hint == nullptr) 138 { 139 orxout(internal_error, context::quests) << "Quest pointer is nullptr." << endl; 140 140 return false; 141 141 } … … 173 173 @return 174 174 Returns a pointer to the Quest with the input id. 175 Returns NULLif there is no Quest with the given questId.175 Returns nullptr if there is no Quest with the given questId. 176 176 @throws 177 177 Throws an exception if the given questId is invalid. … … 188 188 else 189 189 { 190 quest = NULL;190 quest = nullptr; 191 191 orxout(internal_warning, context::quests) << "The quest with id {" << questId << "} is nowhere to be found." << endl; 192 192 } … … 202 202 @return 203 203 Returns a pointer to the QuestHint with the input id. 204 Returns NULLif there is no QuestHint with the given hintId.204 Returns nullptr if there is no QuestHint with the given hintId. 205 205 @throws 206 206 Throws an exception if the given hintId is invalid. … … 217 217 else 218 218 { 219 hint = NULL;219 hint = nullptr; 220 220 orxout(internal_warning, context::quests) << "The hint with id {" << hintId << "} is nowhere to be found." << endl; 221 221 } … … 237 237 for(std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++) 238 238 { 239 if(it->second->getParentQuest() == NULL&& !it->second->isInactive(player))239 if(it->second->getParentQuest() == nullptr && !it->second->isInactive(player)) 240 240 numQuests++; 241 241 } … … 257 257 for(std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++) 258 258 { 259 if(it->second->getParentQuest() == NULL&& !it->second->isInactive(player) && index-- == 0)259 if(it->second->getParentQuest() == nullptr && !it->second->isInactive(player) && index-- == 0) 260 260 return it->second; 261 261 } 262 return NULL;262 return nullptr; 263 263 } 264 264 … … 275 275 int QuestManager::getNumSubQuests(Quest* quest, PlayerInfo* player) 276 276 { 277 if(quest == NULL)277 if(quest == nullptr) 278 278 return this->getNumRootQuests(player); 279 279 … … 300 300 Quest* QuestManager::getSubQuest(Quest* quest, PlayerInfo* player, int index) 301 301 { 302 if(quest == NULL)302 if(quest == nullptr) 303 303 return this->getRootQuest(player, index); 304 304 … … 309 309 return *it; 310 310 } 311 return NULL;311 return nullptr; 312 312 } 313 313 … … 354 354 return *it; 355 355 } 356 return NULL;356 return nullptr; 357 357 } 358 358 … … 367 367 Quest* QuestManager::getParentQuest(Quest* quest) 368 368 { 369 OrxAssert(quest, "The input Quest is NULL.");369 OrxAssert(quest, "The input Quest is nullptr."); 370 370 return quest->getParentQuest(); 371 371 } … … 381 381 QuestDescription* QuestManager::getDescription(Quest* item) 382 382 { 383 OrxAssert(item, "The input Quest is NULL.");383 OrxAssert(item, "The input Quest is nullptr."); 384 384 return item->getDescription(); 385 385 } … … 395 395 QuestDescription* QuestManager::getDescription(QuestHint* item) 396 396 { 397 OrxAssert(item, "The input QuestHint is NULL.");397 OrxAssert(item, "The input QuestHint is nullptr."); 398 398 return item->getDescription(); 399 399 } … … 409 409 const std::string QuestManager::getId(Quest* item) const 410 410 { 411 OrxAssert(item, "The input Quest is NULL.");411 OrxAssert(item, "The input Quest is nullptr."); 412 412 return item->getId(); 413 413 } … … 423 423 const std::string QuestManager::getId(QuestHint* item) const 424 424 { 425 OrxAssert(item, "The input QuestHint is NULL.");425 OrxAssert(item, "The input QuestHint is nullptr."); 426 426 return item->getId(); 427 427 } … … 440 440 { 441 441 PlayerInfo* player = GUIManager::getInstance().getPlayer(guiName); 442 if(player == NULL)442 if(player == nullptr) 443 443 { 444 444 orxout(internal_error, context::quests) << "GUIOverlay with name '" << guiName << "' has no player." << endl; 445 return NULL;445 return nullptr; 446 446 } 447 447 -
code/branches/cpp11_v2/src/modules/questsystem/effects/AddQuest.cc
r9667 r10765 90 90 { 91 91 Quest* quest = QuestManager::getInstance().findQuest(this->getQuestId()); 92 if(quest == NULL|| !quest->start(player))92 if(quest == nullptr || !quest->start(player)) 93 93 return false; 94 94 } -
code/branches/cpp11_v2/src/modules/questsystem/effects/AddQuestHint.cc
r9667 r10765 113 113 { 114 114 QuestHint* hint = QuestManager::getInstance().findHint(this->hintId_); 115 if(hint == NULL|| !hint->setActive(player))115 if(hint == nullptr || !hint->setActive(player)) 116 116 return false; 117 117 } -
code/branches/cpp11_v2/src/modules/questsystem/effects/AddReward.cc
r9667 r10765 90 90 i--; 91 91 } 92 return NULL;92 return nullptr; 93 93 } 94 94 -
code/branches/cpp11_v2/src/modules/questsystem/effects/CompleteQuest.cc
r9667 r10765 92 92 { 93 93 quest = QuestManager::getInstance().findQuest(this->getQuestId()); 94 if(quest == NULL|| !quest->complete(player))94 if(quest == nullptr || !quest->complete(player)) 95 95 return false; 96 96 } -
code/branches/cpp11_v2/src/modules/questsystem/effects/FailQuest.cc
r9667 r10765 91 91 { 92 92 quest = QuestManager::getInstance().findQuest(this->getQuestId()); 93 if(quest == NULL|| !quest->fail(player))93 if(quest == nullptr || !quest->fail(player)) 94 94 return false; 95 95 }
Note: See TracChangeset
for help on using the changeset viewer.