Changeset 2261 for code/trunk/src/orxonox/objects/quest/QuestHint.cc
- Timestamp:
- Nov 25, 2008, 11:56:40 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/questsystem2 (added) merged: 2109,2146,2159,2191,2193-2196,2205-2206,2208-2209,2221,2226,2228,2251,2258
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/QuestHint.cc
- Property svn:mergeinfo changed
/code/branches/questsystem2/src/orxonox/objects/quest/QuestHint.cc (added) merged: 2146,2159,2191,2205,2226,2251 /code/trunk/src/orxonox/objects/quest/QuestHint.cc merged: 1925-2089
r2105 r2261 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/infos/PlayerInfo.h" 42 #include "QuestManager.h" 35 43 #include "Quest.h" 36 44 … … 41 49 /** 42 50 @brief 43 Constructor. 51 Constructor. Registers the object. 44 52 */ 45 53 QuestHint::QuestHint(BaseObject* creator) : QuestItem(creator) 46 54 { 47 55 RegisterObject(QuestHint); 48 49 this->initialize();50 56 } 51 57 … … 59 65 } 60 66 61 void QuestHint::initialize(void) 62 { 63 RegisterObject(QuestHint); 64 } 65 67 /** 68 @brief 69 Method for creating a QuestHint object through XML. 70 */ 66 71 void QuestHint::XMLPort(Element& xmlelement, XMLPort::Mode mode) 67 72 { 68 73 SUPER(QuestHint, XMLPort, xmlelement, mode); 69 74 75 QuestManager::registerHint(this); //!< Registers the QuestHint with the QuestManager. 76 70 77 COUT(3) << "New QuestHint {" << this->getId() << "} created." << std::endl; 71 78 } … … 74 81 /** 75 82 @brief 76 Checks whether the hint is active for a specific player.83 Checks whether the QuestHint is active for a specific player. 77 84 @param player 78 85 The player. … … 80 87 Throws an Argument Exception if the input Player-pointer is NULL. 81 88 @return 82 Returns true if the hint is active for the specified player.89 Returns true if the QuestHint is active for the specified player. 83 90 */ 84 bool QuestHint::isActive( Player* player)91 bool QuestHint::isActive(const PlayerInfo* player) const 85 92 { 86 if(player == NULL) 93 if(player == NULL) //!< NULL-Pointers are ugly! 87 94 { 88 ThrowException(Argument, "The input Player * is NULL.");95 ThrowException(Argument, "The input PlayerInfo* is NULL."); 89 96 return false; 90 97 } 91 98 92 std::map<Player*, questHintStatus::Enum>::iterator it = this->playerStatus_.find(player); 93 if (it != this->playerStatus_.end()) 99 //! Find the player. 100 std::map<const PlayerInfo*, questHintStatus::Enum>::const_iterator it = this->playerStatus_.find(player); 101 if (it != this->playerStatus_.end()) //!< If the player is in the map. 94 102 { 95 103 return it->second; 96 104 } 105 97 106 return questStatus::inactive; 98 107 } … … 106 115 Returns true if the activation was successful, false if there were problems. 107 116 */ 108 bool QuestHint:: activate(Player* player)117 bool QuestHint::setActive(PlayerInfo* player) 109 118 { 110 if(this->quest_->isActive(player)) 119 if(this->quest_->isActive(player)) //!< For a hint to get activated the quest must be active. 111 120 { 112 if(!(this->isActive(player))) 121 if(!(this->isActive(player))) //!< If the hint is already active, activation is pointless. 113 122 { 114 123 this->playerStatus_[player] = questHintStatus::active; … … 121 130 } 122 131 } 132 123 133 COUT(2) << "A hint of a non-active quest was trying to get activated." << std::endl; 124 134 return false; … … 127 137 /** 128 138 @brief 129 Sets the quest the QuestHitnbelongs to.139 Sets the Quest the QuestHint belongs to. 130 140 @param quest 141 The Quest to be set as Quest the QuestHint is attached to. 131 142 @return 143 Returns true if successful. 132 144 */ 133 145 bool QuestHint::setQuest(Quest* quest) 134 146 { 135 if(quest == NULL) 147 if(quest == NULL) //!< NULL-Pointer. Again..? 136 148 { 137 149 COUT(2) << "The input Quest* is NULL." << std::endl; - Property svn:mergeinfo changed
Note: See TracChangeset
for help on using the changeset viewer.