Changeset 3257 for code/branches/core4/src/orxonox/objects/quest
- Timestamp:
- Jun 30, 2009, 3:14:45 PM (16 years ago)
- Location:
- code/branches/core4/src/orxonox/objects/quest
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core4/src/orxonox/objects/quest/GlobalQuest.cc
r3196 r3257 147 147 return false; 148 148 } 149 return (this->isInactive(player) && !(this->status_ == questStatus::completed || this->status_ == questStatus::failed));149 return (this->isInactive(player) && !(this->status_ == QuestStatus::Completed || this->status_ == QuestStatus::Failed)); 150 150 } 151 151 … … 189 189 Throws an Exception if player is NULL. 190 190 */ 191 questStatus::EnumGlobalQuest::getStatus(const PlayerInfo* player) const191 QuestStatus::Value GlobalQuest::getStatus(const PlayerInfo* player) const 192 192 { 193 193 if(player == NULL) //!< We don't want NULL-Pointers! … … 203 203 } 204 204 205 return questStatus::inactive;205 return QuestStatus::Inactive; 206 206 } 207 207 … … 217 217 Returns false if player is NULL. 218 218 */ 219 bool GlobalQuest::setStatus(PlayerInfo* player, const questStatus::Enum& status)219 bool GlobalQuest::setStatus(PlayerInfo* player, const QuestStatus::Value & status) 220 220 { 221 221 if(player == NULL) //!< We don't want NULL-Pointers! -
code/branches/core4/src/orxonox/objects/quest/GlobalQuest.h
r3196 r3257 97 97 virtual bool isCompletable(const PlayerInfo* player) const; //!< Checks whether the Quest can be completed. 98 98 99 virtual questStatus::EnumgetStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.99 virtual QuestStatus::Value getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player. 100 100 101 virtual bool setStatus(PlayerInfo* player, const questStatus::Enum& status); //!< Sets the status for a specific player.101 virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status); //!< Sets the status for a specific player. 102 102 103 103 private: 104 104 std::set<PlayerInfo*> players_; //!< The set of players which possess this Quest. 105 questStatus::Enumstatus_; //!< The status of this Quest.105 QuestStatus::Value status_; //!< The status of this Quest. 106 106 std::list<QuestEffect*> rewards_; //!< Reward QuestEffects only invoked on the player completing the Quest. 107 107 -
code/branches/core4/src/orxonox/objects/quest/LocalQuest.cc
r3196 r3257 176 176 Throws an Exception if player is NULL. 177 177 */ 178 questStatus::EnumLocalQuest::getStatus(const PlayerInfo* player) const178 QuestStatus::Value LocalQuest::getStatus(const PlayerInfo* player) const 179 179 { 180 180 if(player == NULL) //!< No player has no defined status. … … 183 183 } 184 184 185 std::map<const PlayerInfo*, questStatus::Enum>::const_iterator it = this->playerStatus_.find(player);185 std::map<const PlayerInfo*, QuestStatus::Value>::const_iterator it = this->playerStatus_.find(player); 186 186 if (it != this->playerStatus_.end()) //!< If there is a player in the map. 187 187 { … … 189 189 } 190 190 191 return questStatus::inactive; //!< If the player is not yet in the map, that means the status of the quest form him is 'inactive'.191 return QuestStatus::Inactive; //!< If the player is not yet in the map, that means the status of the quest form him is 'inactive'. 192 192 } 193 193 … … 203 203 Returns false if player is NULL. 204 204 */ 205 bool LocalQuest::setStatus(PlayerInfo* player, const questStatus::Enum& status)205 bool LocalQuest::setStatus(PlayerInfo* player, const QuestStatus::Value & status) 206 206 { 207 207 if(player == NULL) //!< We can't set a status for no player. -
code/branches/core4/src/orxonox/objects/quest/LocalQuest.h
r3196 r3257 91 91 virtual bool isCompletable(const PlayerInfo* player) const; //!< Checks whether the Quest can be completed. 92 92 93 virtual questStatus::EnumgetStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.94 virtual bool setStatus(PlayerInfo* player, const questStatus::Enum& status); //!< Sets the status for a specific player.93 virtual QuestStatus::Value getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player. 94 virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status); //!< Sets the status for a specific player. 95 95 96 96 private: 97 std::map<const PlayerInfo*, questStatus::Enum> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.97 std::map<const PlayerInfo*, QuestStatus::Value> playerStatus_; //!< List of the status for each player, with the Player-pointer as key. 98 98 99 99 }; -
code/branches/core4/src/orxonox/objects/quest/Quest.cc
r3196 r3257 302 302 bool Quest::isInactive(const PlayerInfo* player) const 303 303 { 304 return this->getStatus(player) == questStatus::inactive;304 return this->getStatus(player) == QuestStatus::Inactive; 305 305 } 306 306 … … 318 318 { 319 319 320 return this->getStatus(player) == questStatus::active;320 return this->getStatus(player) == QuestStatus::Active; 321 321 } 322 322 … … 333 333 bool Quest::isFailed(const PlayerInfo* player) const 334 334 { 335 return this->getStatus(player) == questStatus::failed;335 return this->getStatus(player) == QuestStatus::Failed; 336 336 } 337 337 … … 348 348 bool Quest::isCompleted(const PlayerInfo* player) const 349 349 { 350 return this->getStatus(player) == questStatus::completed;350 return this->getStatus(player) == QuestStatus::Completed; 351 351 } 352 352 … … 362 362 { 363 363 QuestListener::advertiseStatusChange(this->listeners_, "fail"); //!< Tells the QuestListeners, that the status has changed to failed. 364 this->setStatus(player, questStatus::failed);364 this->setStatus(player, QuestStatus::Failed); 365 365 366 366 COUT(4) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." <<std::endl; … … 381 381 { 382 382 QuestListener::advertiseStatusChange(this->listeners_, "complete"); //!< Tells the QuestListeners, that the status has changed to completed. 383 this->setStatus(player, questStatus::completed);383 this->setStatus(player, QuestStatus::Completed); 384 384 385 385 COUT(4) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." <<std::endl; … … 409 409 QuestListener::advertiseStatusChange(this->listeners_, "start"); //!< Tells the QuestListeners, that the status has changed to active. 410 410 411 this->setStatus(player, questStatus::active);411 this->setStatus(player, QuestStatus::Active); 412 412 413 413 this->getDescription()->sendAddQuestNotification(); -
code/branches/core4/src/orxonox/objects/quest/Quest.h
r3196 r3257 43 43 namespace orxonox 44 44 { 45 namespace questStatus45 namespace QuestStatus 46 46 { 47 48 47 //!Different states of a Quest. 49 enum Enum48 enum Value 50 49 { 51 inactive,52 active,53 failed,54 completed50 Inactive, 51 Active, 52 Failed, 53 Completed 55 54 }; 56 57 55 } 58 56 … … 133 131 { return this->completeEffects_; } 134 132 135 virtual questStatus::EnumgetStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player.136 virtual bool setStatus(PlayerInfo* player, const questStatus::Enum& status) = 0; //!< Changes the status for a specific player.133 virtual QuestStatus::Value getStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player. 134 virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status) = 0; //!< Changes the status for a specific player. 137 135 138 136 private: -
code/branches/core4/src/orxonox/objects/quest/QuestEffectBeacon.cc
r3196 r3257 53 53 RegisterObject(QuestEffectBeacon); 54 54 55 this->status_ = QuestEffectBeaconStatus:: active;55 this->status_ = QuestEffectBeaconStatus::Active; 56 56 this->times_ = INFINITE_TIME; 57 57 } … … 162 162 if(activate) 163 163 { 164 this->status_ = QuestEffectBeaconStatus:: active;165 return true; 166 } 167 168 this->status_ = QuestEffectBeaconStatus:: inactive;164 this->status_ = QuestEffectBeaconStatus::Active; 165 return true; 166 } 167 168 this->status_ = QuestEffectBeaconStatus::Inactive; 169 169 return true; 170 170 } … … 190 190 if(this->getTimes() == 0) //!< Set the QuestEffectBeacon to inactive when the number of times it can be executed is reduced to 0. 191 191 { 192 this->status_ = QuestEffectBeaconStatus:: inactive;192 this->status_ = QuestEffectBeaconStatus::Inactive; 193 193 } 194 194 -
code/branches/core4/src/orxonox/objects/quest/QuestEffectBeacon.h
r3196 r3257 44 44 namespace QuestEffectBeaconStatus 45 45 { 46 47 46 //! The status of the beacon, can be either active or inactive. 48 enum Enum47 enum Value 49 48 { 50 inactive,51 active49 Inactive, 50 Active 52 51 }; 53 54 52 } 55 53 … … 98 96 */ 99 97 inline bool isActive(void) 100 { return this->status_ == QuestEffectBeaconStatus:: active; }98 { return this->status_ == QuestEffectBeaconStatus::Active; } 101 99 102 100 bool setActive(bool activate); //!< Set the status of the QuestEffectBeacon. … … 117 115 std::list<QuestEffect*> effects_; //!< The list of QuestEffects to be invoked on the executing player. 118 116 int times_; //!< Number of times the beacon can be exectued. 119 QuestEffectBeaconStatus:: Enumstatus_; //!< The status of the QUestEffectBeacon, Can be eighter active or inactive.117 QuestEffectBeaconStatus::Value status_; //!< The status of the QUestEffectBeacon, Can be eighter active or inactive. 120 118 121 119 bool setTimes(const int & n); //!< Set the number of times the QuestEffectBeacon can be executed. -
code/branches/core4/src/orxonox/objects/quest/QuestHint.cc
r3196 r3257 95 95 96 96 //! Find the player. 97 std::map<const PlayerInfo*, questHintStatus::Enum>::const_iterator it = this->playerStatus_.find(player);97 std::map<const PlayerInfo*, QuestHintStatus::Value>::const_iterator it = this->playerStatus_.find(player); 98 98 if (it != this->playerStatus_.end()) //!< If the player is in the map. 99 99 { … … 101 101 } 102 102 103 return questStatus::inactive;103 return QuestStatus::Inactive; 104 104 } 105 105 … … 118 118 if(!(this->isActive(player))) //!< If the hint is already active, activation is pointless. 119 119 { 120 this->playerStatus_[player] = questHintStatus::active;120 this->playerStatus_[player] = QuestHintStatus::Active; 121 121 122 122 this->getDescription()->sendAddHintNotification(); -
code/branches/core4/src/orxonox/objects/quest/QuestHint.h
r3196 r3257 42 42 namespace orxonox 43 43 { 44 namespace questHintStatus44 namespace QuestHintStatus 45 45 { 46 47 46 //! The state of the hint. 48 enum Enum47 enum Value 49 48 { 50 inactive,51 active49 Inactive, 50 Active 52 51 }; 53 54 52 } 55 53 … … 91 89 private: 92 90 Quest* quest_; //!< The Quest the QuestHint belongs to. 93 std::map<const PlayerInfo*, questHintStatus::Enum> playerStatus_; //!< List of the states for each player, with the Player-pointer as key.91 std::map<const PlayerInfo*, QuestHintStatus::Value> playerStatus_; //!< List of the states for each player, with the Player-pointer as key. 94 92 95 93 }; -
code/branches/core4/src/orxonox/objects/quest/QuestListener.cc
r3196 r3257 51 51 RegisterObject(QuestListener); 52 52 53 this->mode_ = questListenerMode::all;53 this->mode_ = QuestListenerMode::All; 54 54 this->quest_ = NULL; 55 55 } … … 132 132 if(mode == "all") 133 133 { 134 this->mode_ = questListenerMode::all;134 this->mode_ = QuestListenerMode::All; 135 135 } 136 136 else if(mode == "start") 137 137 { 138 this->mode_ = questListenerMode::start;138 this->mode_ = QuestListenerMode::Start; 139 139 } 140 140 else if(mode == "fail") 141 141 { 142 this->mode_ = questListenerMode::fail;142 this->mode_ = QuestListenerMode::Fail; 143 143 } 144 144 else if(mode == "complete") 145 145 { 146 this->mode_ = questListenerMode::complete;146 this->mode_ = QuestListenerMode::Complete; 147 147 } 148 148 else 149 149 { 150 150 COUT(2) << "QuestListener with invalid mode '" << mode << "' created. Mode set to 'all'." << std::endl; 151 this->mode_ = questListenerMode::all;151 this->mode_ = QuestListenerMode::All; 152 152 return false; 153 153 } … … 164 164 std::string QuestListener::getMode(void) 165 165 { 166 if(this->mode_ == questListenerMode::all)166 if(this->mode_ == QuestListenerMode::All) 167 167 { 168 168 return "all"; 169 169 } 170 else if(this->mode_ == questListenerMode::start)170 else if(this->mode_ == QuestListenerMode::Start) 171 171 { 172 172 return "start"; 173 173 } 174 else if(this->mode_ == questListenerMode::fail)174 else if(this->mode_ == QuestListenerMode::Fail) 175 175 { 176 176 return "fail"; 177 177 } 178 else if(this->mode_ == questListenerMode::complete)178 else if(this->mode_ == QuestListenerMode::Complete) 179 179 { 180 180 return "complete"; -
code/branches/core4/src/orxonox/objects/quest/QuestListener.h
r3196 r3257 43 43 namespace orxonox 44 44 { 45 namespace questListenerMode45 namespace QuestListenerMode 46 46 { 47 48 47 //! The mode of the QuestListener. 49 enum Enum48 enum Value 50 49 { 51 all,52 start,53 fail,54 complete50 All, 51 Start, 52 Fail, 53 Complete 55 54 }; 56 57 55 } 58 56 … … 93 91 94 92 private: 95 questListenerMode::Enummode_; //!< The mode of the QuestListener.93 QuestListenerMode::Value mode_; //!< The mode of the QuestListener. 96 94 Quest* quest_; //!< A pointer to the Quest the QuestListener is reacting to. 97 95
Note: See TracChangeset
for help on using the changeset viewer.