Changeset 11071 for code/trunk/src/modules/questsystem
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/questsystem/GlobalQuest.cc
r9667 r11071 94 94 95 95 // Iterate through all players possessing this Quest. 96 for( std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)97 QuestEffect::invokeEffects( *it, this->getFailEffectList());96 for(PlayerInfo* questPlayer : players_) 97 QuestEffect::invokeEffects(questPlayer, this->getFailEffectList()); 98 98 99 99 return true; … … 119 119 120 120 // Iterate through all players possessing the Quest. 121 for( std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)122 QuestEffect::invokeEffects( *it, this->getCompleteEffectList());121 for(PlayerInfo* questPlayer : players_) 122 QuestEffect::invokeEffects(questPlayer, this->getCompleteEffectList()); 123 123 124 124 Quest::complete(player); … … 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 … … 177 177 The player. 178 178 */ 179 QuestStatus ::ValueGlobalQuest::getStatus(const PlayerInfo* player) const179 QuestStatus GlobalQuest::getStatus(const PlayerInfo* player) const 180 180 { 181 181 assert(player); … … 198 198 The status to be set. 199 199 @return 200 Returns false if player is NULL.201 */ 202 bool GlobalQuest::setStatus(PlayerInfo* player, const QuestStatus ::Value& status)200 Returns false if player is nullptr. 201 */ 202 bool GlobalQuest::setStatus(PlayerInfo* player, const QuestStatus & status) 203 203 { 204 204 assert(player); … … 242 242 { 243 243 int i = index; 244 for ( std::list<QuestEffect*>::const_iterator effect = this->rewards_.begin(); effect != this->rewards_.end(); ++effect)244 for (QuestEffect* reward : this->rewards_) 245 245 { 246 246 if(i == 0) 247 return *effect;247 return reward; 248 248 249 249 i--; 250 250 } 251 return NULL;251 return nullptr; 252 252 } 253 253 -
code/trunk/src/modules/questsystem/GlobalQuest.h
r9667 r11071 93 93 virtual ~GlobalQuest(); 94 94 95 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a GlobalQuest object through XML.95 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a GlobalQuest object through XML. 96 96 97 virtual bool fail(PlayerInfo* player) ; //!< Fails the Quest.98 virtual bool complete(PlayerInfo* player) ; //!< Completes the Quest.97 virtual bool fail(PlayerInfo* player) override; //!< Fails the Quest. 98 virtual bool complete(PlayerInfo* player) override; //!< Completes the Quest. 99 99 100 100 protected: 101 virtual bool isStartable(const PlayerInfo* player) const ; //!< Checks whether the Quest can be started.102 virtual bool isFailable(const PlayerInfo* player) const ; //!< Checks whether the Quest can be failed.103 virtual bool isCompletable(const PlayerInfo* player) const ; //!< Checks whether the Quest can be completed.101 virtual bool isStartable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be started. 102 virtual bool isFailable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be failed. 103 virtual bool isCompletable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be completed. 104 104 105 virtual QuestStatus ::Value getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.105 virtual QuestStatus getStatus(const PlayerInfo* player) const override; //!< Returns the status of the Quest for a specific player. 106 106 107 virtual bool setStatus(PlayerInfo* player, const QuestStatus ::Value & status); //!< Sets the status for a specific player.107 virtual bool setStatus(PlayerInfo* player, const QuestStatus & status) override; //!< Sets the status for a specific player. 108 108 109 109 private: 110 110 std::set<PlayerInfo*> players_; //!< The set of players which possess this Quest. 111 QuestStatus ::Valuestatus_; //!< The status of this Quest.111 QuestStatus status_; //!< The status of this Quest. 112 112 std::list<QuestEffect*> rewards_; //!< Reward QuestEffects only invoked on the player completing the Quest. 113 113 -
code/trunk/src/modules/questsystem/LocalQuest.cc
r9667 r11071 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 … … 168 168 Returns the status of the Quest for the input player. 169 169 */ 170 QuestStatus ::ValueLocalQuest::getStatus(const PlayerInfo* player) const170 QuestStatus LocalQuest::getStatus(const PlayerInfo* player) const 171 171 { 172 172 assert(player); 173 173 174 std::map<const PlayerInfo*, QuestStatus ::Value>::const_iterator it = this->playerStatus_.find(player);174 std::map<const PlayerInfo*, QuestStatus>::const_iterator it = this->playerStatus_.find(player); 175 175 if (it != this->playerStatus_.end()) // If there is a player in the map. 176 176 return it->second; … … 188 188 The status to be set. 189 189 @return 190 Returns false if player is NULL.191 */ 192 bool LocalQuest::setStatus(PlayerInfo* player, const QuestStatus ::Value& status)190 Returns false if player is nullptr. 191 */ 192 bool LocalQuest::setStatus(PlayerInfo* player, const QuestStatus & status) 193 193 { 194 194 assert(player); -
code/trunk/src/modules/questsystem/LocalQuest.h
r9667 r11071 87 87 virtual ~LocalQuest(); 88 88 89 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a LocalQuest object through XML.89 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a LocalQuest object through XML. 90 90 91 virtual bool fail(PlayerInfo* player) ; //!< Fails the Quest.92 virtual bool complete(PlayerInfo* player) ; //!< Completes the Quest.91 virtual bool fail(PlayerInfo* player) override; //!< Fails the Quest. 92 virtual bool complete(PlayerInfo* player) override; //!< Completes the Quest. 93 93 94 94 protected: 95 virtual bool isStartable(const PlayerInfo* player) const ; //!< Checks whether the Quest can be started.96 virtual bool isFailable(const PlayerInfo* player) const ; //!< Checks whether the Quest can be failed.97 virtual bool isCompletable(const PlayerInfo* player) const ; //!< Checks whether the Quest can be completed.95 virtual bool isStartable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be started. 96 virtual bool isFailable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be failed. 97 virtual bool isCompletable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be completed. 98 98 99 virtual QuestStatus ::Value getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.100 virtual bool setStatus(PlayerInfo* player, const QuestStatus ::Value & status); //!< Sets the status for a specific player.99 virtual QuestStatus getStatus(const PlayerInfo* player) const override; //!< Returns the status of the Quest for a specific player. 100 virtual bool setStatus(PlayerInfo* player, const QuestStatus & status) override; //!< Sets the status for a specific player. 101 101 102 102 private: 103 std::map<const PlayerInfo*, QuestStatus ::Value> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.103 std::map<const PlayerInfo*, QuestStatus> playerStatus_; //!< List of the status for each player, with the Player-pointer as key. 104 104 105 105 }; -
code/trunk/src/modules/questsystem/Quest.cc
r10624 r11071 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 … … 190 190 191 191 // Iterate through all subquests. 192 for ( std::list<Quest*>::const_iterator subQuest = this->subQuests_.begin(); subQuest != this->subQuests_.end(); ++subQuest)192 for (Quest* quest : this->subQuests_) 193 193 { 194 194 if(i == 0) // We're counting down... 195 return *subQuest;195 return quest; 196 196 197 197 i--; 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 … … 214 214 215 215 // Iterate through all QuestHints. 216 for ( std::list<QuestHint*>::const_iterator hint = this->hints_.begin(); hint != this->hints_.end(); ++hint)216 for (QuestHint* hint : this->hints_) 217 217 { 218 218 if(i == 0) // We're counting down... 219 return *hint;219 return hint; 220 220 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 … … 237 237 238 238 // Iterate through all fail QuestEffects. 239 for ( std::list<QuestEffect*>::const_iterator effect = this->failEffects_.begin(); effect != this->failEffects_.end(); ++effect)239 for (QuestEffect* effect : this->failEffects_) 240 240 { 241 241 if(i == 0) // We're counting down... 242 return *effect;242 return effect; 243 243 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 … … 260 260 261 261 // Iterate through all complete QuestEffects. 262 for ( std::list<QuestEffect*>::const_iterator effect = this->completeEffects_.begin(); effect != this->completeEffects_.end(); ++effect)262 for (QuestEffect* effect : this->completeEffects_) 263 263 { 264 264 if(i == 0) // We're counting down... 265 return *effect;265 return effect; 266 266 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/trunk/src/modules/questsystem/Quest.h
r9667 r11071 51 51 @ingroup Questsystem 52 52 */ 53 namespaceQuestStatus53 enum class QuestStatus 54 54 { 55 enum Value 56 { 57 Inactive, //!< The @ref orxonox::Quest "Quest" is inactive. 58 Active, //!< The @ref orxonox::Quest "Quest" is active. 59 Failed, //!< The @ref orxonox::Quest "Quest" has been failed. 60 Completed //!< The @ref orxonox::Quest "Quest" has been completed. 61 }; 62 } 55 Inactive, //!< The @ref orxonox::Quest "Quest" is inactive. 56 Active, //!< The @ref orxonox::Quest "Quest" is active. 57 Failed, //!< The @ref orxonox::Quest "Quest" has been failed. 58 Completed //!< The @ref orxonox::Quest "Quest" has been completed. 59 }; 63 60 64 61 /** … … 85 82 virtual ~Quest(); 86 83 87 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a Quest object through XML.84 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a Quest object through XML. 88 85 89 86 /** … … 143 140 { return this->completeEffects_; } 144 141 145 virtual QuestStatus ::ValuegetStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player.146 virtual bool setStatus(PlayerInfo* player, const QuestStatus ::Value& status) = 0; //!< Changes the status for a specific player.142 virtual QuestStatus getStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player. 143 virtual bool setStatus(PlayerInfo* player, const QuestStatus & status) = 0; //!< Changes the status for a specific player. 147 144 148 145 private: -
code/trunk/src/modules/questsystem/QuestDescription.cc
r9667 r11071 119 119 } 120 120 121 NotificationListener::sendNotification(message, QuestDescription::SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());121 NotificationListener::sendNotification(message, QuestDescription::SENDER, NotificationMessageType::info, NotificationSendMode::network, player->getClientID()); 122 122 return true; 123 123 } -
code/trunk/src/modules/questsystem/QuestDescription.h
r9667 r11071 67 67 virtual ~QuestDescription(); 68 68 69 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a QuestDescription object through XML.69 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestDescription object through XML. 70 70 71 71 // tolua_begin -
code/trunk/src/modules/questsystem/QuestEffect.cc
r10624 r11071 74 74 orxout(verbose, context::quests) << "Invoking QuestEffects on player: " << player << " ." << endl; 75 75 76 for ( std::list<QuestEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)77 temp = temp && (*effect)->invoke(player);76 for (QuestEffect* effect : effects) 77 temp = temp && effect->invoke(player); 78 78 79 79 return temp; -
code/trunk/src/modules/questsystem/QuestEffectBeacon.cc
r9667 r11071 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; … … 236 236 { 237 237 int i = index; 238 for ( std::list<QuestEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)238 for (QuestEffect* effect : this->effects_) 239 239 { 240 240 if(i == 0) 241 return *effect;241 return effect; 242 242 243 243 i--; 244 244 } 245 return NULL;245 return nullptr; 246 246 } 247 247 -
code/trunk/src/modules/questsystem/QuestEffectBeacon.h
r9667 r11071 50 50 @ingroup Questsystem 51 51 */ 52 namespaceQuestEffectBeaconStatus52 enum class QuestEffectBeaconStatus 53 53 { 54 enum Value 55 { 56 Inactive, //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is inactive. 57 Active //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is active. 58 }; 59 } 54 Inactive, //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is inactive. 55 Active //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is active. 56 }; 60 57 61 58 /** … … 96 93 virtual ~QuestEffectBeacon(); 97 94 98 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a QuestEffectBeacon object through XML.99 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) ;95 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestEffectBeacon object through XML. 96 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 100 97 101 98 bool execute(bool bTriggered, BaseObject* trigger); //!< Executes the QuestEffects of the QuestEffectBeacon. … … 125 122 std::list<QuestEffect*> effects_; //!< The list of QuestEffects to be invoked on the executing player. 126 123 int times_; //!< Number of times the beacon can be exectued. 127 QuestEffectBeaconStatus ::Valuestatus_; //!< The status of the QuestEffectBeacon, Can be eighter active or inactive.124 QuestEffectBeaconStatus status_; //!< The status of the QuestEffectBeacon, Can be eighter active or inactive. 128 125 129 126 bool setTimes(const int & n); //!< Set the number of times the QuestEffectBeacon can be executed. -
code/trunk/src/modules/questsystem/QuestHint.cc
r9667 r11071 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 93 93 // Find the player. 94 std::map<const PlayerInfo*, QuestHintStatus ::Value>::const_iterator it = this->playerStatus_.find(player);94 std::map<const PlayerInfo*, QuestHintStatus>::const_iterator it = this->playerStatus_.find(player); 95 95 if (it != this->playerStatus_.end()) // If the player is in the map. 96 return it->second;96 return (it->second == QuestHintStatus::Active); 97 97 98 return QuestStatus::Inactive;98 return false; 99 99 } 100 100 -
code/trunk/src/modules/questsystem/QuestHint.h
r9667 r11071 50 50 @ingroup Questsystem 51 51 */ 52 namespaceQuestHintStatus52 enum class QuestHintStatus 53 53 { 54 enum Value 55 { 56 Inactive, //!< The @ref orxonox::QuestHint "QuestHint" is inactive. 57 Active //!< The @ref orxonox::QuestHint "QuestHint" is active. 58 }; 59 } 54 Inactive, //!< The @ref orxonox::QuestHint "QuestHint" is inactive. 55 Active //!< The @ref orxonox::QuestHint "QuestHint" is active. 56 }; 60 57 61 58 /** … … 85 82 virtual ~QuestHint(); 86 83 87 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a QuestHint object through XML.84 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestHint object through XML. 88 85 89 86 bool isActive(const PlayerInfo* player) const; //!< Returns true if the QuestHint is active for the input player. … … 101 98 private: 102 99 Quest* quest_; //!< The Quest the QuestHint belongs to. 103 std::map<const PlayerInfo*, QuestHintStatus ::Value> playerStatus_; //!< List of the states for each player, with the Player-pointer as key.100 std::map<const PlayerInfo*, QuestHintStatus> playerStatus_; //!< List of the states for each player, with the Player-pointer as key. 104 101 105 102 }; // tolua_export -
code/trunk/src/modules/questsystem/QuestItem.h
r9667 r11071 63 63 virtual ~QuestItem(); 64 64 65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a QuestItem object through XML.65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestItem object through XML. 66 66 67 67 /** -
code/trunk/src/modules/questsystem/QuestListener.cc
r9667 r11071 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 … … 97 97 /* static */ void QuestListener::advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status) 98 98 { 99 for (std::list<QuestListener*>::iterator it = listeners.begin(); it != listeners.end(); ++it) // Iterate through all QuestListeners 100 { 101 QuestListener* listener = *it; 99 for (QuestListener* listener : listeners) // Iterate through all QuestListeners 100 { 102 101 if(listener->getMode() == status || listener->getMode() == QuestListener::ALL) // Check whether the status change affects the give QuestListener. 103 102 listener->execute(); … … 117 116 this->quest_ = QuestManager::getInstance().findQuest(id); // Find the Quest corresponding to the given questId. 118 117 119 if(this->quest_ == NULL) // If there is no such Quest.118 if(this->quest_ == nullptr) // If there is no such Quest. 120 119 { 121 120 ThrowException(Argument, "This is bad! The QuestListener has not found a Quest with a corresponding id.."); -
code/trunk/src/modules/questsystem/QuestListener.h
r9667 r11071 50 50 @ingroup Questsystem 51 51 */ 52 namespaceQuestListenerMode52 enum class QuestListenerMode 53 53 { 54 enum Value 55 { 56 All, //!< Listens to all events. 57 Start, //!< Only listens to events pertaining the starting of @ref orxonox::Quest "Quests". 58 Fail, //!< Only listens to events pertaining the failing of @ref orxonox::Quest "Quests". 59 Complete //!< Only listens to events pertaining the completing of @ref orxonox::Quest "Quests". 60 }; 61 } 54 All, //!< Listens to all events. 55 Start, //!< Only listens to events pertaining the starting of @ref orxonox::Quest "Quests". 56 Fail, //!< Only listens to events pertaining the failing of @ref orxonox::Quest "Quests". 57 Complete //!< Only listens to events pertaining the completing of @ref orxonox::Quest "Quests". 58 }; 62 59 63 60 /** … … 90 87 virtual ~QuestListener(); 91 88 92 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a QuestListener object through XML.89 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestListener object through XML. 93 90 94 91 static void advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status); //!< Makes all QuestListener in the list aware that a certain status change has occured. … … 103 100 104 101 private: 105 QuestListenerMode ::Valuemode_; //!< The mode of the QuestListener.102 QuestListenerMode mode_; //!< The mode of the QuestListener. 106 103 Quest* quest_; //!< A pointer to the Quest the QuestListener is reacting to. 107 104 -
code/trunk/src/modules/questsystem/QuestManager.cc
r10624 r11071 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 } … … 235 235 { 236 236 int numQuests = 0; 237 for( std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)238 { 239 if( it->second->getParentQuest() == NULL && !it->second->isInactive(player))237 for(const auto& mapEntry : this->questMap_) 238 { 239 if(mapEntry.second->getParentQuest() == nullptr && !mapEntry.second->isInactive(player)) 240 240 numQuests++; 241 241 } … … 255 255 Quest* QuestManager::getRootQuest(PlayerInfo* player, int index) 256 256 { 257 for( std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)258 { 259 if( it->second->getParentQuest() == NULL && !it->second->isInactive(player) && index-- == 0)260 return it->second;261 } 262 return NULL;257 for(const auto& mapEntry : this->questMap_) 258 { 259 if(mapEntry.second->getParentQuest() == nullptr && !mapEntry.second->isInactive(player) && index-- == 0) 260 return mapEntry.second; 261 } 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 280 280 std::list<Quest*> quests = quest->getSubQuestList(); 281 281 int numQuests = 0; 282 for( std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)283 { 284 if(! (*it)->isInactive(player))282 for(Quest* subquest : quests) 283 { 284 if(!subquest->isInactive(player)) 285 285 numQuests++; 286 286 } … … 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 305 305 std::list<Quest*> quests = quest->getSubQuestList(); 306 for( std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)307 { 308 if(! (*it)->isInactive(player) && index-- == 0)309 return *it;310 } 311 return NULL;306 for(Quest* subquest : quests) 307 { 308 if(!subquest->isInactive(player) && index-- == 0) 309 return quest; 310 } 311 return nullptr; 312 312 } 313 313 … … 326 326 std::list<QuestHint*> hints = quest->getHintsList(); 327 327 int numHints = 0; 328 for( std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)329 { 330 if( (*it)->isActive(player))328 for(QuestHint* hint : hints) 329 { 330 if(hint->isActive(player)) 331 331 numHints++; 332 332 } … … 349 349 { 350 350 std::list<QuestHint*> hints = quest->getHintsList(); 351 for( std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)352 { 353 if( (*it)->isActive(player) && index-- == 0)354 return *it;355 } 356 return NULL;351 for(QuestHint* hint : hints) 352 { 353 if(hint->isActive(player) && index-- == 0) 354 return hint; 355 } 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/trunk/src/modules/questsystem/effects/AddQuest.cc
r9667 r11071 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/trunk/src/modules/questsystem/effects/AddQuest.h
r9667 r11071 62 62 virtual ~AddQuest(); 63 63 64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a AddQuest object through XML.64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a AddQuest object through XML. 65 65 66 virtual bool invoke(PlayerInfo* player) ; //!< Invokes the QuestEffect.66 virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect. 67 67 68 68 }; -
code/trunk/src/modules/questsystem/effects/AddQuestHint.cc
r9667 r11071 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/trunk/src/modules/questsystem/effects/AddQuestHint.h
r9667 r11071 64 64 virtual ~AddQuestHint(); 65 65 66 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a AddQuestHint object through XML.66 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a AddQuestHint object through XML. 67 67 68 virtual bool invoke(PlayerInfo* player) ; //!< Invokes the QuestEffect.68 virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect. 69 69 70 70 private: -
code/trunk/src/modules/questsystem/effects/AddReward.cc
r9667 r11071 84 84 { 85 85 int i = index; 86 for ( std::list<Rewardable*>::const_iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward)86 for (Rewardable* reward : this->rewards_) 87 87 { 88 88 if(i == 0) 89 return *reward;89 return reward; 90 90 i--; 91 91 } 92 return NULL;92 return nullptr; 93 93 } 94 94 … … 106 106 107 107 bool temp = true; 108 for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward)109 temp = temp && (*reward)->reward(player);108 for (Rewardable* reward : this->rewards_) 109 temp = temp && reward->reward(player); 110 110 111 111 orxout(verbose, context::quests) << "Rewardable successfully added to player." << player << " ." << endl; -
code/trunk/src/modules/questsystem/effects/AddReward.h
r9667 r11071 68 68 virtual ~AddReward(); 69 69 70 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a AddReward object through XML.70 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a AddReward object through XML. 71 71 72 virtual bool invoke(PlayerInfo* player) ; //!< Invokes the QuestEffect.72 virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect. 73 73 74 74 private: -
code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.h
r9667 r11071 59 59 virtual ~ChangeQuestStatus(); 60 60 61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a ChangeQuestStatus object through XML.61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a ChangeQuestStatus object through XML. 62 62 63 63 virtual bool invoke(PlayerInfo* player) = 0; //!< Invokes the QuestEffect. -
code/trunk/src/modules/questsystem/effects/CompleteQuest.cc
r9667 r11071 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/trunk/src/modules/questsystem/effects/CompleteQuest.h
r9667 r11071 62 62 virtual ~CompleteQuest(); 63 63 64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a CompleteQuest object through XML.64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a CompleteQuest object through XML. 65 65 66 virtual bool invoke(PlayerInfo* player) ; //!< Invokes the QuestEffect.66 virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect. 67 67 68 68 }; -
code/trunk/src/modules/questsystem/effects/FailQuest.cc
r9667 r11071 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 } -
code/trunk/src/modules/questsystem/effects/FailQuest.h
r9667 r11071 62 62 virtual ~FailQuest(); 63 63 64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a FailQuest object through XML.64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a FailQuest object through XML. 65 65 66 virtual bool invoke(PlayerInfo* player) ; //!< Invokes the QuestEffect.66 virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect. 67 67 68 68 };
Note: See TracChangeset
for help on using the changeset viewer.