Changeset 2226 for code/branches/questsystem2/src/orxonox/objects/quest
- Timestamp:
- Nov 19, 2008, 4:06:09 PM (16 years ago)
- Location:
- code/branches/questsystem2/src/orxonox/objects/quest
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem2/src/orxonox/objects/quest/AddQuest.cc
r2209 r2226 73 73 { 74 74 SUPER(AddQuest, XMLPort, xmlelement, mode); 75 75 76 COUT(3) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl; 76 77 } 77 78 … … 97 98 { 98 99 Quest* quest = QuestManager::findQuest(this->getQuestId()); 99 if( !quest->start(player))100 if(quest == NULL || !quest->start(player)) 100 101 { 101 102 return false; -
code/branches/questsystem2/src/orxonox/objects/quest/AddQuestHint.cc
r2205 r2226 74 74 75 75 XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode); 76 76 77 COUT(3) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl; 77 78 } 78 79 … … 113 114 } 114 115 116 COUT(3) << "AddQuestHint on player: " << player << " ." << std::endl; 117 115 118 try 116 119 { 117 120 QuestHint* hint = QuestManager::findHint(this->hintId_); 118 if( !hint->setActive(player))121 if(hint == NULL || !hint->setActive(player)) 119 122 { 120 123 return false; … … 127 130 } 128 131 132 COUT(3) << "QuestHint {" << this->getHintId() << "} successfully added to player." << std::endl; 129 133 return true; 130 134 -
code/branches/questsystem2/src/orxonox/objects/quest/AddReward.cc
r2205 r2226 70 70 71 71 XMLPortObject(AddReward, Rewardable, "", addRewardable, getRewardables, xmlelement, mode); 72 72 73 COUT(3) << "New AddReward, with " << this->rewards_size() << " Rewardables created." << std::endl; 73 74 } 74 75 -
code/branches/questsystem2/src/orxonox/objects/quest/ChangeQuestStatus.cc
r2191 r2226 61 61 /** 62 62 @brief 63 Method for creating a ChangeQuestStatus object through XML. 64 */ 65 void ChangeQuestStatus::XMLPort(Element& xmlelement, XMLPort::Mode mode) 66 { 67 SUPER(ChangeQuestStatus, XMLPort, xmlelement, mode); 68 69 XMLPortParam(ChangeQuestStatus, "questId", setQuestId, getQuestId, xmlelement, mode); 70 } 71 72 /** 73 @brief 63 74 Sets the id of the Quest the Questffect changes the status of. 64 75 @param id … … 79 90 } 80 91 81 /**82 @brief83 Method for creating a ChangeQuestStatus object through XML.84 */85 void ChangeQuestStatus::XMLPort(Element& xmlelement, XMLPort::Mode mode)86 {87 SUPER(ChangeQuestStatus, XMLPort, xmlelement, mode);88 89 XMLPortParam(ChangeQuestStatus, "questId", setQuestId, getQuestId, xmlelement, mode);90 }91 92 92 } -
code/branches/questsystem2/src/orxonox/objects/quest/CompleteQuest.cc
r2209 r2226 71 71 { 72 72 SUPER(CompleteQuest, XMLPort, xmlelement, mode); 73 74 COUT(3) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl; 73 75 } 74 76 … … 96 98 { 97 99 quest = QuestManager::findQuest(this->getQuestId()); 98 if( !quest->complete(player))100 if(quest == NULL || !quest->complete(player)) 99 101 { 100 102 return false; -
code/branches/questsystem2/src/orxonox/objects/quest/FailQuest.cc
r2205 r2226 71 71 { 72 72 SUPER(FailQuest, XMLPort, xmlelement, mode); 73 74 COUT(3) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl; 73 75 } 74 76 … … 89 91 } 90 92 93 COUT(3) << "FailQuest on player: " << player << " ." << std::endl; 94 95 Quest* quest; 91 96 try 92 97 { 93 Quest*quest = QuestManager::findQuest(this->getQuestId());94 if( !quest->fail(player))98 quest = QuestManager::findQuest(this->getQuestId()); 99 if(quest == NULL || !quest->fail(player)) 95 100 { 96 101 return false; … … 102 107 return false; 103 108 } 104 109 110 COUT(3) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl; 105 111 return true; 106 112 } -
code/branches/questsystem2/src/orxonox/objects/quest/GlobalQuest.cc
r2205 r2226 147 147 bool GlobalQuest::isStartable(const PlayerInfo* player) const 148 148 { 149 return this->isInactive(player) || this->isActive(player);149 return (this->isInactive(player) && !(this->status_ == questStatus::completed || this->status_ == questStatus::failed)); 150 150 } 151 151 -
code/branches/questsystem2/src/orxonox/objects/quest/GlobalQuest.h
r2205 r2226 101 101 102 102 virtual questStatus::Enum getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player. 103 103 104 virtual bool setStatus(PlayerInfo* player, const questStatus::Enum & status); //!< Sets the status for a specific player. 104 105 -
code/branches/questsystem2/src/orxonox/objects/quest/Quest.cc
r2205 r2226 79 79 XMLPortObject(Quest, QuestEffect, "complete-effects", addCompleteEffect, getCompleteEffect, xmlelement, mode); 80 80 81 QuestManager::registerQuest(this); // Registers the quest with the QuestManager.81 QuestManager::registerQuest(this); //!<Registers the Quest with the QuestManager. 82 82 } 83 83 -
code/branches/questsystem2/src/orxonox/objects/quest/QuestEffectBeacon.cc
r2221 r2226 79 79 XMLPortParam(QuestEffectBeacon, "times", setTimes, getTimes, xmlelement, mode); 80 80 XMLPortObject(QuestEffectBeacon, QuestEffect, "effects", addEffect, getEffect, xmlelement, mode); 81 82 COUT(3) << "New QuestEffectBeacon created." << std::endl; 81 83 } 82 84 … … 107 109 if(!b) 108 110 { 109 //TDO: Better message, please. 110 COUT(2) << "b is false." << std::endl; 111 return false; 111 112 } 112 113 if(!(this->isActive())) //!< If the QuestEffectBeacon is inactive it cannot be executed. … … 126 127 if(entity == NULL) 127 128 { 128 COUT(2) << " No one triggered the beacon? Curious!" << std::endl;129 COUT(2) << "The QuestEffectBeacon was triggered by an entity other than a ControllableEntity." << std::endl; 129 130 return false; 130 131 } -
code/branches/questsystem2/src/orxonox/objects/quest/QuestEffectBeacon.h
r2221 r2226 71 71 <events> 72 72 <execute> 73 < PlayerTrigger /> //A PlayerTrigger triggering the execution of the QuestEffectBeacon.73 <EventListener event=eventIdString /> 74 74 </execute> 75 75 </events> 76 <attached> 77 <PlayerTrigger name=eventIdString /> //A PlayerTrigger triggering the execution of the QuestEffectBeacon. 78 </attached> 76 79 </QuestEffectBeacon> 77 80 @author -
code/branches/questsystem2/src/orxonox/objects/quest/QuestHint.cc
r2205 r2226 40 40 41 41 #include "orxonox/objects/infos/PlayerInfo.h" 42 #include "QuestManager.h" 42 43 #include "Quest.h" 43 44 … … 72 73 SUPER(QuestHint, XMLPort, xmlelement, mode); 73 74 75 QuestManager::registerHint(this); //!< Registers the QuestHint with the QuestManager. 76 74 77 COUT(3) << "New QuestHint {" << this->getId() << "} created." << std::endl; 75 78 }
Note: See TracChangeset
for help on using the changeset viewer.