Changeset 2205 for code/branches/questsystem2/src/orxonox/objects
- Timestamp:
- Nov 13, 2008, 9:55:01 PM (16 years ago)
- Location:
- code/branches/questsystem2/src/orxonox/objects
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem2/src/orxonox/objects/quest/AddQuest.cc
r2191 r2205 41 41 #include "util/Exception.h" 42 42 43 #include "orxonox/objects/ worldentities/ControllableEntity.h"43 #include "orxonox/objects/infos/PlayerInfo.h" 44 44 #include "QuestManager.h" 45 45 #include "Quest.h" … … 84 84 Returns true if the QuestEffect was successfully invoked. 85 85 */ 86 bool AddQuest::invoke( ControllableEntity* player)86 bool AddQuest::invoke(PlayerInfo* player) 87 87 { 88 88 if(player == NULL) //!< Null-pointers are badass. … … 106 106 } 107 107 108 COUT(3) << "Quest {" << this->getQuestId() << "} successfully added to player." << std::endl; 108 109 return true; 109 110 } -
code/branches/questsystem2/src/orxonox/objects/quest/AddQuest.h
r2191 r2205 59 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuest object through XML. 60 60 61 virtual bool invoke( ControllableEntity* player); //!< Invokes the QuestEffect.61 virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect. 62 62 63 63 }; -
code/branches/questsystem2/src/orxonox/objects/quest/AddQuestHint.cc
r2191 r2205 39 39 #include "util/Exception.h" 40 40 41 #include "orxonox/objects/ worldentities/ControllableEntity.h"41 #include "orxonox/objects/infos/PlayerInfo.h" 42 42 #include "QuestManager.h" 43 43 #include "QuestItem.h" … … 105 105 Returns true if the QuestEffect was successfully invoked. 106 106 */ 107 bool AddQuestHint::invoke( ControllableEntity* player)107 bool AddQuestHint::invoke(PlayerInfo* player) 108 108 { 109 109 if(player == NULL) //!< NULL-pointers are evil! -
code/branches/questsystem2/src/orxonox/objects/quest/AddQuestHint.h
r2191 r2205 58 58 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuestHint object through XML. 59 59 60 virtual bool invoke( ControllableEntity* player); //!< Invokes the QuestEffect.60 virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect. 61 61 62 62 private: -
code/branches/questsystem2/src/orxonox/objects/quest/AddReward.cc
r2191 r2205 38 38 #include "core/CoreIncludes.h" 39 39 40 #include "orxonox/objects/ worldentities/ControllableEntity.h"40 #include "orxonox/objects/infos/PlayerInfo.h" 41 41 #include "Rewardable.h" 42 42 … … 103 103 Returns true if the QuestEffect was invoked successfully. 104 104 */ 105 bool AddReward::invoke( ControllableEntity* player)105 bool AddReward::invoke(PlayerInfo* player) 106 106 { 107 107 bool check = true; -
code/branches/questsystem2/src/orxonox/objects/quest/AddReward.h
r2191 r2205 59 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddReward object through XML. 60 60 61 virtual bool invoke( ControllableEntity* player); //!< Invokes the QuestEffect.61 virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect. 62 62 63 63 private: -
code/branches/questsystem2/src/orxonox/objects/quest/ChangeQuestStatus.h
r2191 r2205 59 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a ChangeQuestStatus object through XML. 60 60 61 virtual bool invoke( ControllableEntity* player) = 0; //!< Invokes the QuestEffect.61 virtual bool invoke(PlayerInfo* player) = 0; //!< Invokes the QuestEffect. 62 62 63 63 protected: -
code/branches/questsystem2/src/orxonox/objects/quest/CompleteQuest.cc
r2191 r2205 39 39 #include "util/Exception.h" 40 40 41 #include "orxonox/objects/ worldentities/ControllableEntity.h"41 #include "orxonox/objects/infos/PlayerInfo.h" 42 42 #include "QuestManager.h" 43 43 #include "Quest.h" … … 81 81 Returns true if the QuestEffect was invoked successfully. 82 82 */ 83 bool CompleteQuest::invoke( ControllableEntity* player)83 bool CompleteQuest::invoke(PlayerInfo* player) 84 84 { 85 85 if(player == NULL) //!< You know, what we think of NULL-pointers... -
code/branches/questsystem2/src/orxonox/objects/quest/CompleteQuest.h
r2191 r2205 59 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CompleteQuest object through XML. 60 60 61 virtual bool invoke( ControllableEntity* player); //!< Invokes the QuestEffect.61 virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect. 62 62 63 63 }; -
code/branches/questsystem2/src/orxonox/objects/quest/FailQuest.cc
r2191 r2205 39 39 #include "util/Exception.h" 40 40 41 #include "orxonox/objects/ worldentities/ControllableEntity.h"41 #include "orxonox/objects/infos/PlayerInfo.h" 42 42 #include "QuestManager.h" 43 43 #include "Quest.h" … … 81 81 Returns true if the QuestEffect was invoked successfully. 82 82 */ 83 bool FailQuest::invoke( ControllableEntity* player)83 bool FailQuest::invoke(PlayerInfo* player) 84 84 { 85 85 if(player == NULL) //!< We don't know what to do with no player. -
code/branches/questsystem2/src/orxonox/objects/quest/FailQuest.h
r2191 r2205 59 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a FailQuest object through XML. 60 60 61 virtual bool invoke( ControllableEntity* player); //!< Invokes the QuestEffect.61 virtual bool invoke(PlayerInfo* player); //!< Invokes the QuestEffect. 62 62 63 63 }; -
code/branches/questsystem2/src/orxonox/objects/quest/GlobalQuest.cc
r2191 r2205 36 36 #include "GlobalQuest.h" 37 37 38 #include "orxonox/objects/ worldentities/ControllableEntity.h"38 #include "orxonox/objects/infos/PlayerInfo.h" 39 39 #include "core/CoreIncludes.h" 40 40 #include "util/Exception.h" … … 86 86 Returns true if the Quest could be failed, false if not. 87 87 */ 88 bool GlobalQuest::fail( ControllableEntity* player)88 bool GlobalQuest::fail(PlayerInfo* player) 89 89 { 90 90 if(this->isFailable(player)) //!< Check whether the Quest can be failed. … … 93 93 94 94 //! Iterate through all players possessing this Quest. 95 for(std::set< ControllableEntity*>::const_iterator it = players_.begin(); it != players_.end(); it++)95 for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++) 96 96 { 97 97 QuestEffect::invokeEffects(*it, this->getFailEffectList()); … … 115 115 Returns true if the Quest could be completed, false if not. 116 116 */ 117 bool GlobalQuest::complete( ControllableEntity* player)117 bool GlobalQuest::complete(PlayerInfo* player) 118 118 { 119 119 if(this->isCompletable(player)) //!< Check whether the Quest can be completed. … … 122 122 123 123 //! Iterate through all players possessing the Quest. 124 for(std::set< ControllableEntity*>::const_iterator it = players_.begin(); it != players_.end(); it++)124 for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++) 125 125 { 126 126 QuestEffect::invokeEffects(*it, this->getCompleteEffectList()); … … 145 145 Throws an exception if either isInactive() of isActive() throws one. 146 146 */ 147 bool GlobalQuest::isStartable(const ControllableEntity* player) const147 bool GlobalQuest::isStartable(const PlayerInfo* player) const 148 148 { 149 149 return this->isInactive(player) || this->isActive(player); … … 160 160 Throws an Exception if isActive() throws one. 161 161 */ 162 bool GlobalQuest::isFailable(const ControllableEntity* player) const162 bool GlobalQuest::isFailable(const PlayerInfo* player) const 163 163 { 164 164 return this->isActive(player); … … 176 176 Throws an Exception if isActive() throws one. 177 177 */ 178 bool GlobalQuest::isCompletable(const ControllableEntity* player) const178 bool GlobalQuest::isCompletable(const PlayerInfo* player) const 179 179 { 180 180 return this->isActive(player); … … 189 189 Throws an Exception if player is NULL. 190 190 */ 191 questStatus::Enum GlobalQuest::getStatus(const ControllableEntity* player) const191 questStatus::Enum GlobalQuest::getStatus(const PlayerInfo* player) const 192 192 { 193 193 if(player == NULL) //!< We don't want NULL-Pointers! 194 194 { 195 ThrowException(Argument, "The input ControllableEntity* is NULL.");195 ThrowException(Argument, "The input PlayerInfo* is NULL."); 196 196 } 197 197 198 198 //! Find the player. 199 std::set< ControllableEntity*>::const_iterator it = this->players_.find((ControllableEntity*)(void*)player);199 std::set<PlayerInfo*>::const_iterator it = this->players_.find((PlayerInfo*)(void*)player); 200 200 if (it != this->players_.end()) //!< If the player was found. 201 201 { … … 217 217 Returns false if player is NULL. 218 218 */ 219 bool GlobalQuest::setStatus( ControllableEntity* player, const questStatus::Enum & status)219 bool GlobalQuest::setStatus(PlayerInfo* player, const questStatus::Enum & status) 220 220 { 221 221 if(player == NULL) //!< We don't want NULL-Pointers! … … 225 225 226 226 //! Find the player. 227 std::set< ControllableEntity*>::const_iterator it = this->players_.find(player);227 std::set<PlayerInfo*>::const_iterator it = this->players_.find(player); 228 228 if (it == this->players_.end()) //!< Player is not yet in the list. 229 229 { -
code/branches/questsystem2/src/orxonox/objects/quest/GlobalQuest.h
r2191 r2205 92 92 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a GlobalQuest object through XML. 93 93 94 virtual bool fail( ControllableEntity* player); //!< Fails the Quest.95 virtual bool complete( ControllableEntity* player); //!< Completes the Quest.94 virtual bool fail(PlayerInfo* player); //!< Fails the Quest. 95 virtual bool complete(PlayerInfo* player); //!< Completes the Quest. 96 96 97 97 protected: 98 virtual bool isStartable(const ControllableEntity* player) const; //!< Checks whether the Quest can be started.99 virtual bool isFailable(const ControllableEntity* player) const; //!< Checks whether the Quest can be failed.100 virtual bool isCompletable(const ControllableEntity* player) const; //!< Checks whether the Quest can be completed.98 virtual bool isStartable(const PlayerInfo* player) const; //!< Checks whether the Quest can be started. 99 virtual bool isFailable(const PlayerInfo* player) const; //!< Checks whether the Quest can be failed. 100 virtual bool isCompletable(const PlayerInfo* player) const; //!< Checks whether the Quest can be completed. 101 101 102 virtual questStatus::Enum getStatus(const ControllableEntity* player) const; //!< Returns the status of the Quest for a specific player.103 virtual bool setStatus( ControllableEntity* player, const questStatus::Enum & status); //!< Sets the status for a specific player.102 virtual questStatus::Enum getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player. 103 virtual bool setStatus(PlayerInfo* player, const questStatus::Enum & status); //!< Sets the status for a specific player. 104 104 105 105 private: 106 std::set< ControllableEntity*> players_; //!< The set of players which possess this Quest.106 std::set<PlayerInfo*> players_; //!< The set of players which possess this Quest. 107 107 questStatus::Enum status_; //!< The status of this Quest. 108 108 std::list<QuestEffect*> rewards_; //!< Reward QuestEffects only invoked on the player completing the Quest. -
code/branches/questsystem2/src/orxonox/objects/quest/LocalQuest.cc
r2191 r2205 39 39 #include "util/Exception.h" 40 40 41 #include "orxonox/objects/ worldentities/ControllableEntity.h"41 #include "orxonox/objects/infos/PlayerInfo.h" 42 42 #include "QuestEffect.h" 43 43 … … 84 84 Returns true if the Quest could be failed, false if not. 85 85 */ 86 bool LocalQuest::fail( ControllableEntity* player)86 bool LocalQuest::fail(PlayerInfo* player) 87 87 { 88 88 if(this->isFailable(player)) //!< Checks whether the quest can be failed. … … 106 106 Returns true if the Quest could be completed, false if not. 107 107 */ 108 bool LocalQuest::complete( ControllableEntity* player)108 bool LocalQuest::complete(PlayerInfo* player) 109 109 { 110 110 if(this->isCompletable(player)) //!< Checks whether the Quest can be completed. … … 127 127 Returns true if the Quest can be started, false if not. 128 128 @throws 129 Throws an exception if isInactive( ControllableEntity*) throws one.130 */ 131 bool LocalQuest::isStartable(const ControllableEntity* player) const129 Throws an exception if isInactive(PlayerInfo*) throws one. 130 */ 131 bool LocalQuest::isStartable(const PlayerInfo* player) const 132 132 { 133 133 return this->isInactive(player); … … 142 142 Returns true if the Quest can be failed, false if not. 143 143 @throws 144 Throws an exception if isActive( ControllableEntity*) throws one.145 */ 146 bool LocalQuest::isFailable(const ControllableEntity* player) const144 Throws an exception if isActive(PlayerInfo*) throws one. 145 */ 146 bool LocalQuest::isFailable(const PlayerInfo* player) const 147 147 { 148 148 return this->isActive(player); … … 157 157 Returns true if the Quest can be completed, false if not. 158 158 @throws 159 Throws an exception if isInactive( ControllableEntity*) throws one.160 */ 161 bool LocalQuest::isCompletable(const ControllableEntity* player) const159 Throws an exception if isInactive(PlayerInfo*) throws one. 160 */ 161 bool LocalQuest::isCompletable(const PlayerInfo* player) const 162 162 { 163 163 return this->isActive(player); … … 174 174 Throws an Exception if player is NULL. 175 175 */ 176 questStatus::Enum LocalQuest::getStatus(const ControllableEntity* player) const176 questStatus::Enum LocalQuest::getStatus(const PlayerInfo* player) const 177 177 { 178 178 if(player == NULL) //!< No player has no defined status. 179 179 { 180 ThrowException(Argument, "The input ControllableEntity* is NULL.");181 } 182 183 std::map< ControllableEntity*, questStatus::Enum>::const_iterator it = this->playerStatus_.find((ControllableEntity*)(void*)player); //Thx. to x3n for the (ControllableEntity*)(void*) 'hack'.180 ThrowException(Argument, "The input PlayerInfo* is NULL."); 181 } 182 183 std::map<const PlayerInfo*, questStatus::Enum>::const_iterator it = this->playerStatus_.find(player); 184 184 if (it != this->playerStatus_.end()) //!< If there is a player in the map. 185 185 { … … 201 201 Returns false if player is NULL. 202 202 */ 203 bool LocalQuest::setStatus( ControllableEntity* player, const questStatus::Enum & status)203 bool LocalQuest::setStatus(PlayerInfo* player, const questStatus::Enum & status) 204 204 { 205 205 if(player == NULL) //!< We can't set a status for no player. -
code/branches/questsystem2/src/orxonox/objects/quest/LocalQuest.h
r2191 r2205 87 87 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a LocalQuest object through XML. 88 88 89 virtual bool fail( ControllableEntity* player); //!< Fails the Quest.90 virtual bool complete( ControllableEntity* player); //!< Completes the Quest.89 virtual bool fail(PlayerInfo* player); //!< Fails the Quest. 90 virtual bool complete(PlayerInfo* player); //!< Completes the Quest. 91 91 92 92 protected: 93 virtual bool isStartable(const ControllableEntity* player) const; //!< Checks whether the Quest can be started.94 virtual bool isFailable(const ControllableEntity* player) const; //!< Checks whether the Quest can be failed.95 virtual bool isCompletable(const ControllableEntity* player) const; //!< Checks whether the Quest can be completed.93 virtual bool isStartable(const PlayerInfo* player) const; //!< Checks whether the Quest can be started. 94 virtual bool isFailable(const PlayerInfo* player) const; //!< Checks whether the Quest can be failed. 95 virtual bool isCompletable(const PlayerInfo* player) const; //!< Checks whether the Quest can be completed. 96 96 97 virtual questStatus::Enum getStatus(const ControllableEntity* player) const; //!< Returns the status of the Quest for a specific player.98 virtual bool setStatus( ControllableEntity* player, const questStatus::Enum & status); //!< Sets the status for a specific player.97 virtual questStatus::Enum getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player. 98 virtual bool setStatus(PlayerInfo* player, const questStatus::Enum & status); //!< Sets the status for a specific player. 99 99 100 100 private: 101 std::map< ControllableEntity*, questStatus::Enum> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.101 std::map<const PlayerInfo*, questStatus::Enum> playerStatus_; //!< List of the status for each player, with the Player-pointer as key. 102 102 103 103 }; -
code/branches/questsystem2/src/orxonox/objects/quest/Quest.cc
r2191 r2205 38 38 #include "core/CoreIncludes.h" 39 39 40 #include "orxonox/objects/ worldentities/ControllableEntity.h"40 #include "orxonox/objects/infos/PlayerInfo.h" 41 41 #include "QuestManager.h" 42 42 #include "QuestDescription.h" … … 313 313 Throws an exception if getStatus throws one. 314 314 */ 315 bool Quest::isInactive(const ControllableEntity* player) const315 bool Quest::isInactive(const PlayerInfo* player) const 316 316 { 317 317 return this->getStatus(player) == questStatus::inactive; … … 328 328 Throws an exception if getStatus throws one. 329 329 */ 330 bool Quest::isActive(const ControllableEntity* player) const330 bool Quest::isActive(const PlayerInfo* player) const 331 331 { 332 332 … … 344 344 Throws an exception if getStatus throws one. 345 345 */ 346 bool Quest::isFailed(const ControllableEntity* player) const346 bool Quest::isFailed(const PlayerInfo* player) const 347 347 { 348 348 return this->getStatus(player) == questStatus::failed; … … 359 359 Throws an exception if getStatus throws one. 360 360 */ 361 bool Quest::isCompleted(const ControllableEntity* player) const361 bool Quest::isCompleted(const PlayerInfo* player) const 362 362 { 363 363 return this->getStatus(player) == questStatus::completed; … … 372 372 Returns true if the Quest could be started, false if not. 373 373 */ 374 bool Quest::start( ControllableEntity* player)374 bool Quest::start(PlayerInfo* player) 375 375 { 376 376 if(this->isStartable(player)) //!< Checks whether the quest can be started. -
code/branches/questsystem2/src/orxonox/objects/quest/Quest.h
r2191 r2205 44 44 45 45 #include "core/XMLPort.h" 46 46 47 #include "QuestItem.h" 47 48 48 49 49 namespace questStatus … … 104 104 { return this->hints_; } 105 105 106 bool isInactive(const ControllableEntity* player) const; //!< Returns true if the quest status for the specific player is 'inactive'.107 bool isActive(const ControllableEntity* player) const; //!< Returns true if the quest status for the specific player is 'active'.108 bool isFailed(const ControllableEntity* player) const; //!< Returns true if the quest status for the specific player is 'failed'.109 bool isCompleted(const ControllableEntity* player) const; //!< Returns true if the quest status for the specific player is 'completed'.106 bool isInactive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'inactive'. 107 bool isActive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'active'. 108 bool isFailed(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'failed'. 109 bool isCompleted(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'completed'. 110 110 111 bool start( ControllableEntity* player); //!< Sets a Quest to active.112 virtual bool fail( ControllableEntity* player) = 0; //!< Fails the Quest.113 virtual bool complete( ControllableEntity* player) = 0; //!< Completes the Quest.111 bool start(PlayerInfo* player); //!< Sets a Quest to active. 112 virtual bool fail(PlayerInfo* player) = 0; //!< Fails the Quest. 113 virtual bool complete(PlayerInfo* player) = 0; //!< Completes the Quest. 114 114 115 115 protected: 116 virtual bool isStartable(const ControllableEntity* player) const = 0; //!< Checks whether the Quest can be started.117 virtual bool isFailable(const ControllableEntity* player) const = 0; //!< Checks whether the Quest can be failed.118 virtual bool isCompletable(const ControllableEntity* player) const = 0; //!< Checks whether the Quest can be completed.116 virtual bool isStartable(const PlayerInfo* player) const = 0; //!< Checks whether the Quest can be started. 117 virtual bool isFailable(const PlayerInfo* player) const = 0; //!< Checks whether the Quest can be failed. 118 virtual bool isCompletable(const PlayerInfo* player) const = 0; //!< Checks whether the Quest can be completed. 119 119 120 120 const Quest* getParentQuest(void); //!< Returns the parentquest of the Quest. … … 138 138 { return this->completeEffects_; } 139 139 140 virtual questStatus::Enum getStatus(const ControllableEntity* player) const = 0; //!< Returns the status of the Quest for a specific player.141 virtual bool setStatus( ControllableEntity* player, const questStatus::Enum & status) = 0; //!< Changes the status for a specific player.140 virtual questStatus::Enum getStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player. 141 virtual bool setStatus(PlayerInfo* player, const questStatus::Enum & status) = 0; //!< Changes the status for a specific player. 142 142 143 143 private: -
code/branches/questsystem2/src/orxonox/objects/quest/QuestDescription.cc
r2159 r2205 34 34 35 35 #include "OrxonoxStableHeaders.h" 36 36 37 #include "QuestDescription.h" 37 38 -
code/branches/questsystem2/src/orxonox/objects/quest/QuestEffect.cc
r2191 r2205 38 38 #include "core/CoreIncludes.h" 39 39 40 #include "orxonox/objects/ worldentities/ControllableEntity.h"40 #include "orxonox/objects/infos/PlayerInfo.h" 41 41 42 42 namespace orxonox { … … 71 71 Returns false if there was an error, view console of log for further detail. 72 72 */ 73 bool QuestEffect::invokeEffects( ControllableEntity* player, std::list<QuestEffect*> & effects)73 bool QuestEffect::invokeEffects(PlayerInfo* player, std::list<QuestEffect*> & effects) 74 74 { 75 75 bool check = true; -
code/branches/questsystem2/src/orxonox/objects/quest/QuestEffect.h
r2191 r2205 57 57 virtual ~QuestEffect(); 58 58 59 virtual bool invoke( ControllableEntity* player) = 0; //!< Invokes the QuestEffect.60 static bool invokeEffects( ControllableEntity* player, std::list<QuestEffect*> & effects); //!< Invokes all QuestEffects in the list.59 virtual bool invoke(PlayerInfo* player) = 0; //!< Invokes the QuestEffect. 60 static bool invokeEffects(PlayerInfo* player, std::list<QuestEffect*> & effects); //!< Invokes all QuestEffects in the list. 61 61 62 62 -
code/branches/questsystem2/src/orxonox/objects/quest/QuestEffectBeacon.cc
r2196 r2205 35 35 #include "core/EventIncludes.h" 36 36 37 #include "orxonox/objects/infos/PlayerInfo.h" 37 38 #include "orxonox/objects/worldentities/ControllableEntity.h" 38 39 #include "orxonox/objects/worldentities/triggers/PlayerTrigger.h" … … 50 51 this->times_ = -1; 51 52 this->trigger_ = NULL; 52 this->player_ = NULL;53 53 } 54 54 … … 69 69 { 70 70 SetSubclassEvent(QuestEffectBeacon, "execute", execute, event, PlayerTrigger); 71 72 this->player_ = dynamic_cast<ControllableEntity*>(event.originator_);73 71 } 74 72 75 bool QuestEffectBeacon::execute( void)73 bool QuestEffectBeacon::execute(bool b, ControllableEntity* entity) 76 74 { 77 78 if(!(this->isActive())) 75 if(!b || !(this->isActive())) 79 76 { 80 77 return false; 81 78 } 82 if( this->player_== NULL)79 if(entity == NULL) 83 80 { 84 81 return false; 85 82 } 86 83 87 bool check = QuestEffect::invokeEffects(this->player_, this->effects_); 84 PlayerInfo* player = entity->getPlayer(); 85 86 bool check = QuestEffect::invokeEffects(player, this->effects_); 88 87 if(check) 89 88 { -
code/branches/questsystem2/src/orxonox/objects/quest/QuestEffectBeacon.h
r2196 r2205 63 63 virtual void processEvent(Event& event); 64 64 65 bool execute( void);65 bool execute(bool b, ControllableEntity* player); 66 66 67 67 bool isActive(void); … … 78 78 QuestEffectBeaconStatus::Enum status_; 79 79 PlayerTrigger* trigger_; 80 ControllableEntity* player_;81 80 82 81 bool setTimes(const int & n); -
code/branches/questsystem2/src/orxonox/objects/quest/QuestHint.cc
r2191 r2205 39 39 #include "util/Exception.h" 40 40 41 #include "orxonox/objects/ worldentities/ControllableEntity.h"41 #include "orxonox/objects/infos/PlayerInfo.h" 42 42 #include "Quest.h" 43 43 … … 86 86 Returns true if the QuestHint is active for the specified player. 87 87 */ 88 bool QuestHint::isActive( ControllableEntity* player)88 bool QuestHint::isActive(const PlayerInfo* player) const 89 89 { 90 90 if(player == NULL) //!< NULL-Pointers are ugly! 91 91 { 92 ThrowException(Argument, "The input ControllableEntity* is NULL.");92 ThrowException(Argument, "The input PlayerInfo* is NULL."); 93 93 return false; 94 94 } 95 95 96 96 //! Find the player. 97 std::map< ControllableEntity*, questHintStatus::Enum>::iterator it = this->playerStatus_.find(player);97 std::map<const PlayerInfo*, questHintStatus::Enum>::const_iterator it = this->playerStatus_.find(player); 98 98 if (it != this->playerStatus_.end()) //!< If the player is in the map. 99 99 { … … 112 112 Returns true if the activation was successful, false if there were problems. 113 113 */ 114 bool QuestHint::setActive( ControllableEntity* player)114 bool QuestHint::setActive(PlayerInfo* player) 115 115 { 116 116 if(this->quest_->isActive(player)) //!< For a hint to get activated the quest must be active. -
code/branches/questsystem2/src/orxonox/objects/quest/QuestHint.h
r2191 r2205 82 82 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestHint object through XML. 83 83 84 bool isActive( ControllableEntity* player); //!< Returns true if the QuestHint is active for the input player.84 bool isActive(const PlayerInfo* player) const; //!< Returns true if the QuestHint is active for the input player. 85 85 86 bool setActive( ControllableEntity* player); //!< Activates the QuestHint for the input player.86 bool setActive(PlayerInfo* player); //!< Activates the QuestHint for the input player. 87 87 bool setQuest(Quest* quest); //!< Sets the Quest the QuestHint belongs to. 88 88 … … 96 96 private: 97 97 Quest* quest_; //!< The Quest the QuestHint belongs to. 98 std::map< ControllableEntity*, questHintStatus::Enum> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.98 std::map<const PlayerInfo*, questHintStatus::Enum> playerStatus_; //!< List of the status for each player, with the Player-pointer as key. 99 99 100 100 }; -
code/branches/questsystem2/src/orxonox/objects/quest/Rewardable.h
r2159 r2205 66 66 Return true if successful. 67 67 */ 68 virtual bool reward( ControllableEntity* player) = 0; //!<68 virtual bool reward(PlayerInfo* player) = 0; //!< 69 69 70 70 }; -
code/branches/questsystem2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
r2196 r2205 140 140 { 141 141 if (Trigger::isTriggered(mode)) 142 { 143 COUT << "Triggers" << std::endl; 142 144 return checkDistance(); 145 } 143 146 else 144 147 return false;
Note: See TracChangeset
for help on using the changeset viewer.