- Timestamp:
- Nov 6, 2008, 12:02:05 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem2/src/orxonox/objects/quest/QuestHint.cc
r2105 r2146 26 26 * 27 27 */ 28 29 /** 30 @file QuestHint.cc 31 @brief 32 Implementation of the QuestHint class. 33 */ 28 34 29 35 #include "OrxonoxStableHeaders.h" … … 33 39 #include "util/Exception.h" 34 40 41 #include "orxonox/objects/worldentities/ControllableEntity.h" 35 42 #include "Quest.h" 36 43 … … 41 48 /** 42 49 @brief 43 Constructor. 50 Constructor. Initializes the object. 44 51 */ 45 52 QuestHint::QuestHint(BaseObject* creator) : QuestItem(creator) 46 53 { 54 this->initialize(); 55 } 56 57 /** 58 @brief 59 Initialize the object. 60 */ 61 void QuestHint::initialize(void) 62 { 47 63 RegisterObject(QuestHint); 48 49 this->initialize();50 64 } 51 65 … … 59 73 } 60 74 61 void QuestHint::initialize(void) 62 { 63 RegisterObject(QuestHint); 64 } 65 75 /** 76 @brief 77 Method for creating a QuestHint object through XML. 78 */ 66 79 void QuestHint::XMLPort(Element& xmlelement, XMLPort::Mode mode) 67 80 { … … 82 95 Returns true if the hint is active for the specified player. 83 96 */ 84 bool QuestHint::isActive( Player* player)97 bool QuestHint::isActive(ControllableEntity* player) 85 98 { 86 if(player == NULL) 99 if(player == NULL) //!< NULL-Pointers are ugly! 87 100 { 88 ThrowException(Argument, "The input Player* is NULL.");101 ThrowException(Argument, "The input ControllableEntity* is NULL."); 89 102 return false; 90 103 } 91 104 92 std::map<Player*, questHintStatus::Enum>::iterator it = this->playerStatus_.find(player); 93 if (it != this->playerStatus_.end()) 105 //! Find the player. 106 std::map<ControllableEntity*, questHintStatus::Enum>::iterator it = this->playerStatus_.find(player); 107 if (it != this->playerStatus_.end()) //!< If the player is in the map. 94 108 { 95 109 return it->second; 96 110 } 111 97 112 return questStatus::inactive; 98 113 } … … 106 121 Returns true if the activation was successful, false if there were problems. 107 122 */ 108 bool QuestHint:: activate(Player* player)123 bool QuestHint::setActive(ControllableEntity* player) 109 124 { 110 if(this->quest_->isActive(player)) 125 if(this->quest_->isActive(player)) //!< For a hint to get activated the quest must be active. 111 126 { 112 if(!(this->isActive(player))) 127 if(!(this->isActive(player))) //!< If the hint is already active, activation is pointless. 113 128 { 114 129 this->playerStatus_[player] = questHintStatus::active; … … 121 136 } 122 137 } 138 123 139 COUT(2) << "A hint of a non-active quest was trying to get activated." << std::endl; 124 140 return false; … … 129 145 Sets the quest the QuestHitn belongs to. 130 146 @param quest 147 The quest to be set as quest the hint is attached to. 131 148 @return 149 Returns true if successful. 132 150 */ 133 151 bool QuestHint::setQuest(Quest* quest) 134 152 { 135 if(quest == NULL) 153 if(quest == NULL) //!< NULL-Pointer. Again..? 136 154 { 137 155 COUT(2) << "The input Quest* is NULL." << std::endl;
Note: See TracChangeset
for help on using the changeset viewer.