Changeset 2159
- Timestamp:
- Nov 8, 2008, 7:58:49 PM (16 years ago)
- Location:
- code/branches/questsystem2/src/orxonox/objects/quest
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem2/src/orxonox/objects/quest/AddQuest.cc
r2146 r2159 27 27 */ 28 28 29 /** 30 @file AddQuest.cc 31 @brief 32 Implementation of the AddQuest class. 33 */ 34 29 35 #include "OrxonoxStableHeaders.h" 30 36 #include "AddQuest.h" … … 43 49 CreateFactory(AddQuest); 44 50 45 51 /** 52 @brief 53 Constructor. Registers the quest. 54 */ 46 55 AddQuest::AddQuest(BaseObject* creator) : ChangeQuestStatus(creator) 47 56 { … … 57 66 } 58 67 68 /** 69 @brief 70 Method for creating a AddQuest object through XML. 71 */ 59 72 void AddQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode) 60 73 { … … 73 86 bool AddQuest::invoke(ControllableEntity* player) 74 87 { 75 if(player == NULL) 88 if(player == NULL) //!< Null-pointers are badass. 76 89 { 77 90 COUT(2) << "Input player is NULL." << std::endl; -
code/branches/questsystem2/src/orxonox/objects/quest/AddQuest.h
r2146 r2159 27 27 */ 28 28 29 /** 30 @file AddQuest.h 31 @brief 32 Definition of the AddQuest class. 33 */ 34 29 35 #ifndef _AddQuest_H__ 30 36 #define _AddQuest_H__ … … 41 47 /** 42 48 @brief 43 Adds a quest, resp. changes the quests status to active .49 Adds a quest, resp. changes the quests status to active for the player invoking the quest. 44 50 @author 45 51 Damian 'Mozork' Frick … … 51 57 virtual ~AddQuest(); 52 58 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuest object through XML. 54 60 55 61 virtual bool invoke(ControllableEntity* player); //!< Invokes the effect. -
code/branches/questsystem2/src/orxonox/objects/quest/AddQuestHint.cc
r2146 r2159 27 27 */ 28 28 29 /** 30 @file AddQuestHint.cc 31 @brief 32 Implementation of the AddQuestHint class. 33 */ 34 29 35 #include "OrxonoxStableHeaders.h" 30 36 #include "AddQuestHint.h" … … 42 48 CreateFactory(AddQuestHint); 43 49 50 /** 51 @brief 52 Constructor. Registers the object. 53 */ 44 54 AddQuestHint::AddQuestHint(BaseObject* creator) : QuestEffect(creator) 45 55 { … … 55 65 } 56 66 67 /** 68 @brief 69 Method for creating a AddQuestHint object through XML. 70 */ 57 71 void AddQuestHint::XMLPort(Element& xmlelement, XMLPort::Mode mode) 58 72 { … … 63 77 } 64 78 79 /** 80 @brief 81 Sets the id of the quest hint to be added to the player the effect is invoked on. 82 @param id 83 The QuestHint id. 84 @param 85 Returns true if successful. 86 */ 65 87 inline void AddQuestHint::setHintId(const std::string & id) 66 88 { … … 68 90 { 69 91 COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl; 70 return ;92 return false; 71 93 } 94 72 95 this->hintId_ = id; 96 return true; 73 97 } 74 98 … … 83 107 bool AddQuestHint::invoke(ControllableEntity* player) 84 108 { 85 if(player == NULL) 109 if(player == NULL) //!< NULL-pointers are evil! 86 110 { 87 111 COUT(2) << "The input player is NULL." << std::endl; -
code/branches/questsystem2/src/orxonox/objects/quest/AddQuestHint.h
r2146 r2159 27 27 */ 28 28 29 /** 30 @file AddQuestHint.h 31 @brief 32 Definition of the AddQuestHint class. 33 */ 34 29 35 #ifndef _AddQuestHint_H__ 30 36 #define _AddQuestHint_H__ … … 40 46 /** 41 47 @brief 42 Adds a QuestHint, resp. Activates the QuestHint.48 Adds a QuestHint, resp. activates the QuestHint of the given id for the player the effect is invoked on. 43 49 @author 44 50 Damian 'Mozork' Frick … … 50 56 virtual ~AddQuestHint(); 51 57 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 58 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuestHint object through XML. 53 59 54 60 virtual bool invoke(ControllableEntity* player); //!< Invokes the effect. 55 61 56 62 private: 57 std::string hintId_; 63 std::string hintId_; //!< The id of the QuestHint. 58 64 59 inline const std::string & getHintId(void) const 65 inline const std::string & getHintId(void) const //!< Returns the if of the hint. 60 66 { return this->hintId_; } 61 void setHintId(const std::string & id); 67 void setHintId(const std::string & id); //!< Sets the id of the hint. 62 68 63 69 }; -
code/branches/questsystem2/src/orxonox/objects/quest/AddReward.cc
r2146 r2159 27 27 */ 28 28 29 /** 30 @file AddReward.cc 31 @brief 32 Implementation of the AddReward class. 33 */ 34 29 35 #include "OrxonoxStableHeaders.h" 30 36 #include "AddReward.h" … … 39 45 CreateFactory(AddReward); 40 46 47 /** 48 @brief 49 Constructor. Registers the object. 50 */ 41 51 AddReward::AddReward(BaseObject* creator) : QuestEffect(creator) 42 52 { 43 53 RegisterObject(AddReward); 44 45 this->initialize();46 54 } 47 55 … … 54 62 } 55 63 64 /** 65 Method for creating a AddReward object through XML. 66 */ 56 67 void AddReward::XMLPort(Element& xmlelement, XMLPort::Mode mode) 57 68 { … … 64 75 /** 65 76 @brief 66 Initializes the object. Needs to be called first by every constructor of this class. 77 Returns the rewardbale object at the given index. 78 @param index 79 The index. 80 @return 81 Returns a pointer to the rewardable object at the given index. 67 82 */ 68 void AddReward::initialize(void)69 {70 RegisterObject(AddReward);71 }72 73 83 const Rewardable* AddReward::getRewardables(unsigned int index) const 74 84 { -
code/branches/questsystem2/src/orxonox/objects/quest/AddReward.h
r2146 r2159 27 27 */ 28 28 29 /** 30 @file AddReward.h 31 @brief 32 Definition of the AddReward class. 33 */ 34 29 35 #ifndef _AddReward_H__ 30 36 #define _AddReward_H__ … … 51 57 virtual ~AddReward(); 52 58 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddReward object through XML. 54 60 55 61 virtual bool invoke(ControllableEntity* player); //!< Invokes the effect. 56 62 57 63 private: 58 std::list<Rewardable*> rewards_; 64 std::list<Rewardable*> rewards_; //!< A list of rewards to be added to the player invoking the effect. 59 65 60 void initialize(void); //!< Initializes the object. 61 62 inline void addRewardable(Rewardable* reward) 66 inline void addRewardable(Rewardable* reward) //!< Add a rewardable object to the list of objects to be awarded to the player invoking the effect. 63 67 { this->rewards_.push_back(reward); } 64 const Rewardable* getRewardables(unsigned int index) const; 68 const Rewardable* getRewardables(unsigned int index) const; //!< Returns the rewardable object at the given index. 65 69 66 70 }; -
code/branches/questsystem2/src/orxonox/objects/quest/ChangeQuestStatus.cc
r2105 r2159 27 27 */ 28 28 29 /** 30 @file ChangeQuestStatus.cc 31 @brief 32 Implementation of the ChangeQuestStatus class. 33 */ 34 29 35 #include "OrxonoxStableHeaders.h" 30 36 #include "ChangeQuestStatus.h" … … 36 42 namespace orxonox { 37 43 44 /** 45 @brief 46 Constructor. Registers the object. 47 */ 38 48 ChangeQuestStatus::ChangeQuestStatus(BaseObject* creator) : QuestEffect(creator) 39 49 { … … 49 59 } 50 60 51 void ChangeQuestStatus::setQuestId(const std::string & id) 61 /** 62 @brief 63 Sets the id of the quest the effect chagnes the status of. 64 @param id 65 The id of the quest. 66 @return 67 Returns true if successful. 68 */ 69 bool ChangeQuestStatus::setQuestId(const std::string & id) 52 70 { 53 71 if(!QuestItem::isId(id)) 54 72 { 55 73 COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl; 56 return ;74 return false; 57 75 } 76 58 77 this->questId_ = id; 78 return true; 59 79 } 60 80 81 /** 82 @brief 83 Method for creating a ChangeQuestStatus object through XML. 84 */ 61 85 void ChangeQuestStatus::XMLPort(Element& xmlelement, XMLPort::Mode mode) 62 86 { -
code/branches/questsystem2/src/orxonox/objects/quest/ChangeQuestStatus.h
r2146 r2159 27 27 */ 28 28 29 /** 30 @file ChangeQuestStatus.h 31 @brief 32 Definition of the ChangeQuestStatus class. 33 */ 34 29 35 #ifndef _ChangeQuestStatus_H__ 30 36 #define _ChangeQuestStatus_H__ … … 41 47 /** 42 48 @brief 43 An effect which changes a quests status .49 An effect which changes a quests status of a specified quest for the player invoking the effect. 44 50 @author 45 51 Damian 'Mozork' Frick … … 51 57 virtual ~ChangeQuestStatus(); 52 58 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a ChangeQuestStatus object through XML. 54 60 55 61 virtual bool invoke(ControllableEntity* player) = 0; //!< Invokes the effect. … … 59 65 { return this->questId_; } 60 66 67 private: 61 68 std::string questId_; //!< The id of the quest the status should be changed of. 62 63 private: 64 void setQuestId(const std::string & id); 69 70 void setQuestId(const std::string & id); //!< Sets the quest id. 65 71 66 72 }; -
code/branches/questsystem2/src/orxonox/objects/quest/CompleteQuest.cc
r2146 r2159 26 26 * 27 27 */ 28 29 /** 30 @file CompleteQuest.cc 31 @brief 32 Implementation of the CompleteQuest class. 33 */ 28 34 29 35 #include "OrxonoxStableHeaders.h" … … 41 47 CreateFactory(CompleteQuest); 42 48 49 /** 50 @brief 51 Constructor. Registers the object. 52 */ 43 53 CompleteQuest::CompleteQuest(BaseObject* creator) : ChangeQuestStatus(creator) 44 54 { … … 54 64 } 55 65 66 /** 67 @brief 68 Method for creating a CompleteQuest object through XML. 69 */ 56 70 void CompleteQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode) 57 71 { … … 69 83 bool CompleteQuest::invoke(ControllableEntity* player) 70 84 { 71 if(player == NULL) 85 if(player == NULL) //!< You know, what we think of NULL-pointers... 72 86 { 73 87 COUT(2) << "Input player is NULL." << std::endl; -
code/branches/questsystem2/src/orxonox/objects/quest/CompleteQuest.h
r2146 r2159 27 27 */ 28 28 29 /** 30 @file CompleteQuest.h 31 @brief 32 Definition of the CompleteQuest class. 33 */ 34 29 35 #ifndef _CompleteQuest_H__ 30 36 #define _CompleteQuest_H__ … … 41 47 /** 42 48 @brief 43 Completes a quest .49 Completes a quest (with a specified id) for the player invoking the effect. 44 50 @author 45 51 Damian 'Mozork' Frick … … 51 57 virtual ~CompleteQuest(); 52 58 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CompleteQuest object through XML. 54 60 55 61 virtual bool invoke(ControllableEntity* player); //!< Invokes the effect. -
code/branches/questsystem2/src/orxonox/objects/quest/FailQuest.cc
r2146 r2159 26 26 * 27 27 */ 28 29 /** 30 @file FailQuest.cc 31 @brief 32 Implementation of the FailQuest class. 33 */ 28 34 29 35 #include "OrxonoxStableHeaders.h" … … 41 47 CreateFactory(FailQuest); 42 48 49 /** 50 @brief 51 Constructor. Registers the object. 52 */ 43 53 FailQuest::FailQuest(BaseObject* creator) : ChangeQuestStatus(creator) 44 54 { … … 54 64 } 55 65 66 /** 67 @brief 68 Method for creating a FailQuest object through XML. 69 */ 56 70 void FailQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode) 57 71 { … … 69 83 bool FailQuest::invoke(ControllableEntity* player) 70 84 { 71 if(player == NULL) 85 if(player == NULL) //!< We don't know what to do with no player. 72 86 { 73 87 COUT(2) << "Input player is NULL." << std::endl; -
code/branches/questsystem2/src/orxonox/objects/quest/FailQuest.h
r2146 r2159 27 27 */ 28 28 29 /** 30 @file FailQuest.h 31 @brief 32 Definition of the FailQuest class. 33 */ 34 29 35 #ifndef _FailQuest_H__ 30 36 #define _FailQuest_H__ … … 51 57 virtual ~FailQuest(); 52 58 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a FailQuest object through XML. 54 60 55 61 virtual bool invoke(ControllableEntity* player); //!< Invokes the effect. -
code/branches/questsystem2/src/orxonox/objects/quest/GlobalQuest.cc
r2146 r2159 48 48 /** 49 49 @brief 50 Constructor. Initializes the object.50 Constructor. Registers the object. 51 51 */ 52 52 GlobalQuest::GlobalQuest(BaseObject* creator) : Quest(creator) 53 {54 this->initialize();55 }56 57 /**58 @brief59 Initializes the object.60 */61 void GlobalQuest::initialize(void)62 53 { 63 54 RegisterObject(GlobalQuest); … … 104 95 for(std::set<ControllableEntity*>::const_iterator it = players_.begin(); it != players_.end(); it++) 105 96 { 106 QuestEffect::invokeEffects(*it, this-> failEffects_);97 QuestEffect::invokeEffects(*it, this->getFailEffectList()); 107 98 } 108 99 … … 133 124 for(std::set<ControllableEntity*>::const_iterator it = players_.begin(); it != players_.end(); it++) 134 125 { 135 QuestEffect::invokeEffects(*it, this-> completeEffects_);126 QuestEffect::invokeEffects(*it, this->getCompleteEffectList()); 136 127 } 137 128 -
code/branches/questsystem2/src/orxonox/objects/quest/GlobalQuest.h
r2146 r2159 111 111 const QuestEffect* getRewardEffects(unsigned int index) const; //!< Returns the reward effect at the given index. 112 112 113 void initialize(void); //!< Initializes the object.114 115 113 }; 116 114 -
code/branches/questsystem2/src/orxonox/objects/quest/LocalQuest.cc
r2146 r2159 48 48 /** 49 49 @brief 50 Constructor. Initializes the object.50 Constructor. Registers and initializes the object. 51 51 */ 52 52 LocalQuest::LocalQuest(BaseObject* creator) : Quest(creator) 53 {54 this->initialize();55 }56 57 /**58 @brief59 Initializes the object.60 */61 void LocalQuest::initialize(void)62 53 { 63 54 RegisterObject(LocalQuest); … … 98 89 { 99 90 this->setStatus(player, questStatus::failed); 100 QuestEffect::invokeEffects(player, this-> failEffects_); //!< Invoke the failEffects.91 QuestEffect::invokeEffects(player, this->getFailEffectList()); //!< Invoke the failEffects. 101 92 return true; 102 93 } … … 120 111 { 121 112 this->setStatus(player, questStatus::completed); 122 QuestEffect::invokeEffects(player, this-> completeEffects_); //!< Invoke the completeEffects.113 QuestEffect::invokeEffects(player, this->getCompleteEffectList()); //!< Invoke the completeEffects. 123 114 return true; 124 115 } -
code/branches/questsystem2/src/orxonox/objects/quest/LocalQuest.h
r2146 r2159 101 101 std::map<ControllableEntity*, questStatus::Enum> playerStatus_; //!< List of the status for each player, with the Player-pointer as key. 102 102 103 void initialize(void); //!< Initializes the object.104 105 103 }; 106 104 -
code/branches/questsystem2/src/orxonox/objects/quest/Quest.cc
r2146 r2159 48 48 /** 49 49 @brief 50 Constructor. Initializes object.50 Constructor. Registers and initializes object. 51 51 */ 52 52 Quest::Quest(BaseObject* creator) : QuestItem(creator) 53 53 { 54 this->initialize();55 }56 57 /**58 @brief59 Initializes the object. Needs to be called first in every constructor of this class.60 Sets defaults.61 */62 void Quest::initialize(void)63 {64 54 RegisterObject(Quest); 65 55 … … 84 74 SUPER(Quest, XMLPort, xmlelement, mode); 85 75 86 XMLPortObject(Quest, Quest, "subquests", addSubQuest, getSubQuest s, xmlelement, mode);87 XMLPortObject(Quest, QuestHint, "hints", addHint, getHint s, xmlelement, mode);88 XMLPortObject(Quest, QuestEffect, "fail-effects", addFailEffect, getFailEffect s, xmlelement, mode);89 XMLPortObject(Quest, QuestEffect, "complete-effects", addCompleteEffect, getCompleteEffect s, xmlelement, mode);76 XMLPortObject(Quest, Quest, "subquests", addSubQuest, getSubQuest, xmlelement, mode); 77 XMLPortObject(Quest, QuestHint, "hints", addHint, getHint, xmlelement, mode); 78 XMLPortObject(Quest, QuestEffect, "fail-effects", addFailEffect, getFailEffect, xmlelement, mode); 79 XMLPortObject(Quest, QuestEffect, "complete-effects", addCompleteEffect, getCompleteEffect, xmlelement, mode); 90 80 91 81 QuestManager::registerQuest(this); //Registers the quest with the QuestManager. … … 224 214 Returns the subquest of the given index. NULL if there is no element on the given index. 225 215 */ 226 const Quest* Quest::getSubQuest s(unsigned int index) const216 const Quest* Quest::getSubQuest(unsigned int index) const 227 217 { 228 218 int i = index; … … 249 239 Returns the hint of the given index. NULL if there is no element on the given index. 250 240 */ 251 const QuestHint* Quest::getHint s(unsigned int index) const241 const QuestHint* Quest::getHint(unsigned int index) const 252 242 { 253 243 int i = index; … … 273 263 Returns the failEffect of the given index. NULL if there is no element on the given index. 274 264 */ 275 const QuestEffect* Quest::getFailEffect s(unsigned int index) const265 const QuestEffect* Quest::getFailEffect(unsigned int index) const 276 266 { 277 267 int i = index; … … 297 287 Returns the completeEffect of the given index. NULL if there is no element on the given index. 298 288 */ 299 const QuestEffect* Quest::getCompleteEffect s(unsigned int index) const289 const QuestEffect* Quest::getCompleteEffect(unsigned int index) const 300 290 { 301 291 int i = index; -
code/branches/questsystem2/src/orxonox/objects/quest/Quest.h
r2146 r2159 87 87 inline const std::list<Quest*> & getSubQuestList(void) const //!< Returns the list of sub quests. 88 88 { return this->subQuests_; } 89 inline const std::list<QuestHint*> & getHintsList(void) const //!< Returns the list of all hints of this quest. 90 { return this->hints_; } 89 91 90 92 bool isInactive(const ControllableEntity* player) const; //!< Returns true if the quest status for the specific player is 'inactive'. … … 98 100 99 101 protected: 100 void initialize(void); //!< Initializes the object.101 102 102 virtual bool isStartable(const ControllableEntity* player) const = 0; //!< Checks whether the quest can be started. 103 103 virtual bool isFailable(const ControllableEntity* player) const = 0; //!< Checks whether the quest can be failed. 104 104 virtual bool isCompletable(const ControllableEntity* player) const = 0; //!< Checks whether the quest can be completed. 105 105 106 bool setParentQuest(Quest* quest); //!< Sets the parent quest of the quest.107 bool addSubQuest(Quest* quest); //!< Adds a sub quest to the quest.108 bool addHint(QuestHint* hint); //!< Add a hint to the list of hints.109 bool addFailEffect(QuestEffect* effect); //!< Adds an effect to the list of failEffects.110 bool addCompleteEffect(QuestEffect* effect); //!< Adds an effect to the list of completeEffects.111 112 106 const Quest* getParentQuest(void); //!< Returns the parent quest of the quest. 113 const Quest* getSubQuests(unsigned int index) const; //!<Returns the sub quest of the given index. 114 const QuestHint* getHints(unsigned int index) const; //!< Returns the hint of the given index. 115 const QuestEffect* getFailEffects(unsigned int index) const; //!< Returns the failEffect of the given index. 116 const QuestEffect* getCompleteEffects(unsigned int index) const; //!Returns the completeEffect of the given index. 107 const Quest* getSubQuest(unsigned int index) const; //!<Returns the sub quest of the given index. 108 const QuestHint* getHint(unsigned int index) const; //!< Returns the hint of the given index. 109 const QuestEffect* getFailEffect(unsigned int index) const; //!< Returns the failEffect of the given index. 110 const QuestEffect* getCompleteEffect(unsigned int index) const; //!< Returns the completeEffect of the given index. 111 inline std::list<QuestEffect*> & getFailEffectList(void) //!< Returns the list of failEffects. 112 { return this->failEffects_; } 113 inline std::list<QuestEffect*> & getCompleteEffectList(void) //!< Returns the list of completeEffects. 114 { return this->completeEffects_; } 117 115 118 116 virtual questStatus::Enum getStatus(const ControllableEntity* player) const = 0; //!< Returns the status of the quest for a specific player. 119 117 virtual bool setStatus(ControllableEntity* player, const questStatus::Enum & status) = 0; //!< Changes the status for a specific player. 120 118 119 private: 121 120 Quest* parentQuest_; //!< Pointer to the parent quest. 122 121 std::list<Quest*> subQuests_; //!< List of all the sub quests. … … 126 125 std::list<QuestEffect*> failEffects_; //!< A list of all effects to be invoked, when the quest has been failed. 127 126 std::list<QuestEffect*> completeEffects_; //!< A list of effects to be invoked, when the quest has been completed. 127 128 bool setParentQuest(Quest* quest); //!< Sets the parent quest of the quest. 129 bool addSubQuest(Quest* quest); //!< Adds a sub quest to the quest. 130 bool addHint(QuestHint* hint); //!< Add a hint to the list of hints. 131 bool addFailEffect(QuestEffect* effect); //!< Adds an effect to the list of failEffects. 132 bool addCompleteEffect(QuestEffect* effect); //!< Adds an effect to the list of completeEffects. 128 133 129 134 }; -
code/branches/questsystem2/src/orxonox/objects/quest/QuestDescription.cc
r2105 r2159 27 27 */ 28 28 29 /** 30 @file QuestDescription.cc 31 @brief 32 Implementation of the QuestDescription class. 33 */ 34 29 35 #include "OrxonoxStableHeaders.h" 30 36 #include "QuestDescription.h" … … 36 42 CreateFactory(QuestDescription); 37 43 44 /** 45 @brief 46 Constructor. Registers and initializes the object. 47 */ 38 48 QuestDescription::QuestDescription(BaseObject* creator) : BaseObject(creator) 39 49 { 40 50 RegisterObject(QuestDescription); 41 42 this->initialize(); 51 52 this->title_ = ""; 53 this->description_ = ""; 43 54 } 44 55 56 /** 57 @brief 58 Destructor. 59 */ 45 60 QuestDescription::~QuestDescription() 46 61 { … … 48 63 } 49 64 65 /** 66 @brief 67 Method for creating a QuestDescription object through XML. 68 */ 50 69 void QuestDescription::XMLPort(Element& xmlelement, XMLPort::Mode mode) 51 70 { … … 58 77 } 59 78 60 /**61 @brief62 Initializes the object. Has to be called first in every constructor of this class.63 */64 void QuestDescription::initialize(void)65 {66 RegisterObject(QuestDescription);67 }68 69 79 70 80 } -
code/branches/questsystem2/src/orxonox/objects/quest/QuestDescription.h
r2096 r2159 27 27 */ 28 28 29 /** 30 @file QuestDescription.h 31 @brief 32 Definition of the QuestDescription class. 33 */ 34 29 35 #ifndef _QuestDescription_H__ 30 36 #define _QuestDescription_H__ … … 52 58 virtual ~QuestDescription(); 53 59 54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestDescription object through XML. 55 61 56 62 inline const std::string & getTitle(void) const //!< Returns the title. … … 60 66 61 67 private: 62 void initialize(void); 68 std::string title_; //!< The title. 69 std::string description_; //!< The description. 63 70 64 71 inline void setTitle(const std::string & title) //!< Sets the title. … … 67 74 { this->description_ = description; } 68 75 69 std::string title_; //!< The title.70 std::string description_; //!< The description.71 72 76 }; 73 77 -
code/branches/questsystem2/src/orxonox/objects/quest/QuestEffect.cc
r2146 r2159 26 26 * 27 27 */ 28 29 /** 30 @file QuestEffect.cc 31 @brief 32 Implementation of the QuestEffect class. 33 */ 28 34 29 35 #include "OrxonoxStableHeaders.h" … … 57 63 /** 58 64 @brief 59 Static method. Invoke all effects of an effect list.65 Static method. Invoke all effects in an effect list on a given player. 60 66 @param player 61 67 The player the effects are invoked on. -
code/branches/questsystem2/src/orxonox/objects/quest/QuestEffect.h
r2146 r2159 26 26 * 27 27 */ 28 29 /** 30 @file QuestEffect.h 31 @brief 32 Definition of the QuestEffect class. 33 */ 28 34 29 35 #ifndef _QuestEffect_H__ … … 41 47 @brief 42 48 Handles effects for quests. 49 QuestEffects are the only way for quests to have any sideeffects in the game world. They are also the only way to gain, complete or fail quests. 43 50 @author 44 51 Damian 'Mozork' Frick -
code/branches/questsystem2/src/orxonox/objects/quest/QuestHint.cc
r2146 r2159 48 48 /** 49 49 @brief 50 Constructor. Initializes the object.50 Constructor. Registers the object. 51 51 */ 52 52 QuestHint::QuestHint(BaseObject* creator) : QuestItem(creator) 53 {54 this->initialize();55 }56 57 /**58 @brief59 Initialize the object.60 */61 void QuestHint::initialize(void)62 53 { 63 54 RegisterObject(QuestHint); -
code/branches/questsystem2/src/orxonox/objects/quest/QuestHint.h
r2146 r2159 94 94 std::map<ControllableEntity*, questHintStatus::Enum> playerStatus_; //!< List of the status for each player, with the Player-pointer as key. 95 95 96 void initialize(void); //!< Initializes the object.97 98 96 }; 99 97 -
code/branches/questsystem2/src/orxonox/objects/quest/QuestItem.cc
r2146 r2159 47 47 */ 48 48 QuestItem::QuestItem(BaseObject* creator) : BaseObject(creator) 49 {50 RegisterObject(QuestItem);51 52 this->initialize();53 }54 55 /**56 @brief57 Initializes the object.58 Should be called first in every constructor of this class.59 */60 void QuestItem::initialize(void)61 49 { 62 50 RegisterObject(QuestItem); -
code/branches/questsystem2/src/orxonox/objects/quest/QuestItem.h
r2146 r2159 81 81 QuestDescription* description_; //!< The description of the QuestItem. 82 82 83 void initialize(void); //!< Initializes the object.84 85 83 }; 86 84 -
code/branches/questsystem2/src/orxonox/objects/quest/QuestManager.cc
r2105 r2159 27 27 */ 28 28 29 /** 30 @file QuestManager.cc 31 @brief 32 Implementation of the QuestManager class. 33 */ 34 29 35 #include "OrxonoxStableHeaders.h" 30 36 #include "QuestManager.h" … … 38 44 namespace orxonox { 39 45 40 std::map<std::string, Quest*> QuestManager::questMap_; 41 std::map<std::string, QuestHint*> QuestManager::hintMap_; 42 46 //! All quests registered by their id's. 47 std::map<std::string, Quest*> QuestManager::questMap_s; 48 //! All hints registered by their id's. 49 std::map<std::string, QuestHint*> QuestManager::hintMap_s; 50 51 /** 52 @brief 53 Constructor. Registers the object. 54 */ 43 55 QuestManager::QuestManager(BaseObject* creator) : BaseObject(creator) 44 56 { … … 46 58 } 47 59 48 60 /** 61 @brief 62 Destructor. 63 */ 49 64 QuestManager::~QuestManager() 50 65 { … … 55 70 @brief 56 71 Registers a quest with the QuestManager to make it globally accessable. 72 Uses it's id to make sure to be able to be identify and retrieve it later. 57 73 @param quest 58 74 The quest that is to be registered. … … 62 78 bool QuestManager::registerQuest(Quest* quest) 63 79 { 64 if(quest == NULL) 80 if(quest == NULL) //!< Doh! Just as if there were actual quests behind NULL-pointers. 65 81 { 66 82 COUT(2) << "Registration of Quest in QuestManager failed, because inserted Quest-pointer was NULL." << std::endl; … … 68 84 } 69 85 70 std::pair<std::map<std::string, Quest*>::iterator,bool> re t;71 re t = questMap_.insert( std::pair<std::string,Quest*>(quest->getId(),quest) );72 73 if(re t.second)86 std::pair<std::map<std::string, Quest*>::iterator,bool> result; 87 result = questMap_s.insert( std::pair<std::string,Quest*>(quest->getId(),quest) ); //!< Inserting the quest. 88 89 if(result.second) //!< If inserting was a success. 74 90 { 75 91 COUT(3) << "Quest with questId {" << quest->getId() << "} successfully inserted." << std::endl; … … 86 102 @brief 87 103 Registers a QuestHint with the QuestManager to make it globally accessable. 104 Uses it's id to make sure to be able to be identify and retrieve it later. 88 105 @param hint 89 106 The QuestHint to be registered. … … 93 110 bool QuestManager::registerHint(QuestHint* hint) 94 111 { 95 if(hint == NULL) 112 if(hint == NULL) //!< Still not liking NULL-pointers. 96 113 { 97 114 COUT(2) << "Registration of QuestHint in QuestManager failed, because inserted QuestHint-pointer was NULL." << std::endl; … … 99 116 } 100 117 101 std::pair<std::map<std::string, QuestHint*>::iterator,bool> re t;102 re t = hintMap_.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) );103 104 if(re t.second)118 std::pair<std::map<std::string, QuestHint*>::iterator,bool> result; 119 result = hintMap_s.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) ); //!< Inserting the hint. 120 121 if(result.second) //!< If inserting was a success. 105 122 { 106 123 COUT(3) << "QuestHint with hintId {" << hint->getId() << "} successfully inserted." << std::endl; … … 127 144 Quest* QuestManager::findQuest(const std::string & questId) 128 145 { 129 if(!QuestItem::isId(questId)) 146 if(!QuestItem::isId(questId)) //!< Check vor validity of the given id. 130 147 { 131 148 ThrowException(Argument, "Invalid questId."); … … 133 150 134 151 Quest* quest; 135 std::map<std::string, Quest*>::iterator it = questMap_ .find(questId);136 if (it != questMap_ .end())152 std::map<std::string, Quest*>::iterator it = questMap_s.find(questId); 153 if (it != questMap_s.end()) //!< If the quest is registered. 137 154 { 138 155 quest = it->second; … … 161 178 QuestHint* QuestManager::findHint(const std::string & hintId) 162 179 { 163 if(!QuestItem::isId(hintId)) 180 if(!QuestItem::isId(hintId)) //!< Check vor validity of the given id. 164 181 { 165 182 ThrowException(Argument, "Invalid hintId."); … … 167 184 168 185 QuestHint* hint; 169 std::map<std::string, QuestHint*>::iterator it = hintMap_ .find(hintId);170 if (it != hintMap_ .end())186 std::map<std::string, QuestHint*>::iterator it = hintMap_s.find(hintId); 187 if (it != hintMap_s.end()) //!< If the hint is registered. 171 188 { 172 189 hint = it->second; -
code/branches/questsystem2/src/orxonox/objects/quest/QuestManager.h
r2096 r2159 27 27 */ 28 28 29 /** 30 @file QuestManager.h 31 @brief 32 Definition of the QuestManager class. 33 */ 34 29 35 #ifndef _QuestManager_H__ 30 36 #define _QuestManager_H__ … … 41 47 /** 42 48 @brief 43 Manages quests, by making them globally accessable.44 Quests (and Hints) are registered in the QuestManager trough their id, and can be accessed in the same way.49 Is a static class and manages quests, by registering every quest/hint (through registerX()) and making them globally accessable (through findX()). 50 Quests (and Hints) are registered in the QuestManager with their id, and can be accessed in the same way. 45 51 @author 46 52 Damian 'Mozork' Frick … … 60 66 61 67 private: 62 static std::map<std::string, Quest*> questMap_ ; //!< All quests registered by their id's.63 static std::map<std::string, QuestHint*> hintMap_ ; //!< All hints registered by their id's.68 static std::map<std::string, Quest*> questMap_s; //!< All quests registered by their id's. 69 static std::map<std::string, QuestHint*> hintMap_s; //!< All hints registered by their id's. 64 70 65 71 }; -
code/branches/questsystem2/src/orxonox/objects/quest/Rewardable.cc
r2105 r2159 27 27 */ 28 28 29 /** 30 @file Rewardable.cc 31 @brief 32 Implementation of the Rewardable class. 33 */ 34 29 35 #include "OrxonoxStableHeaders.h" 30 36 #include "Rewardable.h" … … 34 40 namespace orxonox { 35 41 36 42 /** 43 @brief 44 Constructor. Registers the object. 45 */ 37 46 Rewardable::Rewardable(BaseObject* creator) : BaseObject(creator) 38 47 { … … 40 49 } 41 50 42 51 /** 52 @brief 53 Destructor, 54 */ 43 55 Rewardable::~Rewardable() 44 56 { -
code/branches/questsystem2/src/orxonox/objects/quest/Rewardable.h
r2146 r2159 27 27 */ 28 28 29 /** 30 @file Rewardable.h 31 @brief 32 Definition of the Rewardable class. 33 */ 34 29 35 #ifndef _Rewardable_H__ 30 36 #define _Rewardable_H__ … … 38 44 /** 39 45 @brief 40 Rewardable is an Interface, that can be implemented by any object to enable it to be given as reward to a player through QuestEffects. 46 Rewardable is an Interface, that can be implemented by any object to enable it to be given as reward to a player through QuestEffects. (With the AddReward effect.) 47 48 It just needs to inherit form Rewardable, and implement the reward() method. 41 49 @author 42 50 Damian 'Mozork' Frick … … 49 57 virtual ~Rewardable(); 50 58 51 virtual bool reward(ControllableEntity* player) = 0; //!<Method to transcribe a rewardable object to the player. 59 /** 60 @brief 61 Method to transcribe a rewardable object to the player. 62 Must be implemented by every class inheriting from Rewardable. 63 @param player 64 A pointer to the ControllableEntity, do whatever you want with it. 65 @return 66 Return true if successful. 67 */ 68 virtual bool reward(ControllableEntity* player) = 0; //!< 52 69 53 70 };
Note: See TracChangeset
for help on using the changeset viewer.