- Timestamp:
- Oct 30, 2008, 9:52:12 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem/src/orxonox/objects/QuestHint.cc
r2021 r2068 28 28 29 29 #include "core/CoreIncludes.h" 30 #include "util/Exception.h" 30 31 31 32 #include "Quest.h" … … 36 37 CreateFactory(QuestHint); 37 38 39 /** 40 @brief 41 Constructor. 42 */ 38 43 QuestHint::QuestHint() : QuestItem() 39 44 { 40 45 this->initialize(); 41 46 } 42 47 … … 51 56 The description of the hint, resp. the hint itself. 52 57 */ 53 QuestHint::QuestHint(std::string id , std::string title, std::string description) : QuestItem(id, title, description)58 QuestHint::QuestHint(std::string id) : QuestItem(id) 54 59 { 55 RegisterObject(QuestHint);60 this->initialize(); 56 61 } 57 62 … … 65 70 } 66 71 72 void QuestHint::initialize(void) 73 { 74 RegisterObject(QuestHint); 75 } 76 77 void QuestHint::XMLPort(Element& xmlelement, XMLPort::Mode mode) 78 { 79 SUPER(QuestHint, XMLPort, xmlelement, mode); 80 } 81 82 67 83 /** 68 84 @brief … … 70 86 @param player 71 87 The player. 88 @throws 89 Throws an Argument Exception if the input Player-pointer is NULL. 72 90 @return 73 Returns 91 Returns true if the hint is active for the specified player. 74 92 */ 75 93 bool QuestHint::isActive(Player* player) 76 94 { 95 if(player == NULL) 96 { 97 ThrowException(Argument, "The input Player* is NULL."); 98 return false; 99 } 100 77 101 std::map<Player*, questHintStatus::Enum>::iterator it = this->playerStatus_.find(player); 78 102 if (it != this->playerStatus_.end()) … … 85 109 /** 86 110 @brief 111 Activates a QuestHint for a given player. 87 112 @param player 113 The player. 88 114 @return 115 Returns true if the activation was successful, false if there were problems. 89 116 */ 90 117 bool QuestHint::activate(Player* player) 91 118 { 92 if(this->quest_->isActive(player) && !(this->isActive(player)))119 if(this->quest_->isActive(player)) 93 120 { 94 this->playerStatus_[player] = questHintStatus::active; 95 return true; 121 if(!(this->isActive(player))) 122 { 123 this->playerStatus_[player] = questHintStatus::active; 124 return true; 125 } 126 else 127 { 128 COUT(2) << "An already active questHint was trying to get activated." << std::endl; 129 return false; 130 } 96 131 } 97 132 COUT(2) << "A hint of a non-active quest was trying to get activated." << std::endl; … … 101 136 /** 102 137 @brief 138 Sets the quest the QuestHitn belongs to. 103 139 @param quest 104 140 @return 105 141 */ 106 voidQuestHint::setQuest(Quest* quest)142 bool QuestHint::setQuest(Quest* quest) 107 143 { 144 if(quest == NULL) 145 { 146 COUT(2) << "The input Quest* is NULL." << std::endl; 147 return false; 148 } 149 108 150 this->quest_ = quest; 151 return true; 109 152 } 110 153
Note: See TracChangeset
for help on using the changeset viewer.