Changeset 2346 for code/branches/questsystem3/src/orxonox/objects
- Timestamp:
- Dec 5, 2008, 7:38:53 AM (16 years ago)
- Location:
- code/branches/questsystem3/src/orxonox/objects/quest
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem3/src/orxonox/objects/quest/AddQuest.cc
r2328 r2346 42 42 43 43 #include "orxonox/objects/infos/PlayerInfo.h" 44 #include "orxonox/overlays/notifications/Notification.h"45 44 #include "QuestManager.h" 46 45 #include "Quest.h" … … 111 110 112 111 COUT(3) << "Quest {" << this->getQuestId() << "} successfully added to player." << std::endl; 113 Notification* notification = new Notification("Crazy Message...", "Title", 30);114 notification->send();115 112 return true; 116 113 } -
code/branches/questsystem3/src/orxonox/objects/quest/CompleteQuest.cc
r2280 r2346 42 42 #include "QuestManager.h" 43 43 #include "Quest.h" 44 #include "orxonox/overlays/notifications/Notification.h"45 44 46 45 namespace orxonox { … … 111 110 112 111 COUT(3) << "Quest {" << quest->getId() << "} successfully completed by player: " << player << " ." << std::endl; 113 Notification* notification = new Notification("Crazy Message...", "Title", 30);114 notification->send();115 112 return true; 116 113 } -
code/branches/questsystem3/src/orxonox/objects/quest/FailQuest.cc
r2328 r2346 40 40 41 41 #include "orxonox/objects/infos/PlayerInfo.h" 42 #include "orxonox/overlays/notifications/Notification.h"43 42 #include "QuestManager.h" 44 43 #include "Quest.h" -
code/branches/questsystem3/src/orxonox/objects/quest/Quest.cc
r2328 r2346 377 377 QuestListener::advertiseStatusChange(this->listeners_, "fail"); //!< Tells the QuestListeners, that the status has changed to failed. 378 378 this->setStatus(player, questStatus::failed); 379 380 this->getDescription()->sendFailQuestNotification(); 379 381 return true; 380 382 } … … 392 394 QuestListener::advertiseStatusChange(this->listeners_, "complete"); //!< Tells the QuestListeners, that the status has changed to completed. 393 395 this->setStatus(player, questStatus::completed); 396 397 this->getDescription()->sendCompleteQuestNotification(); 394 398 return true; 395 399 } … … 414 418 415 419 this->setStatus(player, questStatus::active); 420 421 this->getDescription()->sendAddQuestNotification(); 416 422 return true; 417 423 } -
code/branches/questsystem3/src/orxonox/objects/quest/QuestDescription.cc
r2328 r2346 38 38 39 39 #include "core/CoreIncludes.h" 40 #include "orxonox/overlays/notifications/Notification.h" 40 41 41 42 namespace orxonox { … … 75 76 XMLPortParam(QuestDescription, "description", setDescription, getDescription, xmlelement, mode); 76 77 XMLPortParam(QuestDescription, "failMessage", setFailMessage, getFailMessage, xmlelement, mode); 77 XMLPortParam(QuestDescription, " failMessage", setCompleteMessage, getCompleteMessage, xmlelement, mode);78 XMLPortParam(QuestDescription, "completeMessage", setCompleteMessage, getCompleteMessage, xmlelement, mode); 78 79 79 80 COUT(3) << "New QuestDescription with title '" << this->getTitle() << "' created." << std::endl; 81 } 82 83 /** 84 @brief 85 This method is a helper for sending QuestDescriptions as Notifications. 86 @param item 87 The item the QuestDescription is for. 88 @param status 89 The status the QuestDescription us for. 90 @return 91 Returns true if successful. 92 */ 93 bool QuestDescription::notificationHelper(const std::string & item, const std::string & status) const 94 { 95 std::string message = ""; 96 std::string title = ""; 97 if(item == "hint") 98 { 99 title = "You received a hint: '" + this->title_ + "'"; 100 message = this->description_; 101 } 102 else if(item == "quest") 103 { 104 if(status == "start") 105 { 106 title = "You received a new quest: '" + this->title_ + "'"; 107 message = this->description_; 108 } 109 else if(status == "fail") 110 { 111 title = "You failed the quest: '" + this->title_ + "'"; 112 message = this->failMessage_; 113 } 114 else if(status == "complete") 115 { 116 title = "You successfully completed the quest: '" + this->title_ + "'"; 117 message = this->completeMessage_; 118 } 119 else 120 { 121 COUT(2) << "Bad input in notificationHelper, this should not be happening!" << std::endl; 122 return false; 123 } 124 } 125 else 126 { 127 COUT(2) << "Bad input in notificationHelper, this should not be happening!" << std::endl; 128 return false; 129 } 130 131 Notification* notification = new Notification(message, title, 10); 132 notification->send(); 133 return true; 80 134 } 81 135 -
code/branches/questsystem3/src/orxonox/objects/quest/QuestDescription.h
r2328 r2346 91 91 inline const std::string & getCompleteMessage(void) const 92 92 { return this->completeMessage_; } 93 94 /** 95 @brief Sends a Notification displaying that a QuestHint was added. 96 @return Returns true if successful. 97 */ 98 inline bool sendAddHintNotification(void) const 99 { return notificationHelper("hint", ""); } 100 101 /** 102 @brief Sends a Notification displaying that a Quest was added. 103 @return Returns true if successful. 104 */ 105 inline bool sendAddQuestNotification(void) const 106 { return notificationHelper("quest", "start"); } 107 108 /** 109 @brief Sends a Notification displaying that a Quest was failed. 110 @return Returns true if successful. 111 */ 112 inline bool sendFailQuestNotification(void) const 113 { return notificationHelper("quest", "fail"); } 114 115 /** 116 @brief Sends a Notification displaying that a Quest was completed. 117 @return Returns true if successful. 118 */ 119 inline bool sendCompleteQuestNotification(void) const 120 { return notificationHelper("quest", "complete"); } 93 121 94 122 private: … … 97 125 std::string failMessage_; //!< The message displayed when the Quest is failed. 98 126 std::string completeMessage_; //!< The message displayed when the Quest is completed. 127 128 bool notificationHelper(const std::string & item, const std::string & status) const; //!< Helper for sending QuestDescriptions as Notifications. 99 129 100 130 /** -
code/branches/questsystem3/src/orxonox/objects/quest/QuestHint.cc
r2261 r2346 41 41 #include "orxonox/objects/infos/PlayerInfo.h" 42 42 #include "QuestManager.h" 43 #include "QuestDescription.h" 43 44 #include "Quest.h" 44 45 … … 122 123 { 123 124 this->playerStatus_[player] = questHintStatus::active; 125 126 this->getDescription()->sendAddHintNotification(); 124 127 return true; 125 128 } -
code/branches/questsystem3/src/orxonox/objects/quest/QuestItem.h
r2261 r2346 67 67 /** 68 68 @brief Returns the id of this QuestItem. 69 @return Returns the id of the QuestItem.69 @return Returns the id of the QuestItem. 70 70 */ 71 71 inline const std::string & getId(void) const 72 72 { return this->id_; } 73 74 75 76 73 /** 74 @brief Returns the QuestDescription of the QuestItem. 75 @return Returns a pointer to the QuestDescription object of the QuestItem. 76 */ 77 77 inline const QuestDescription* getDescription(void) const 78 78 { return this->description_; } -
code/branches/questsystem3/src/orxonox/objects/quest/QuestListener.cc
r2333 r2346 43 43 { 44 44 RegisterObject(QuestListener); 45 46 this->status_ = questListenerStatus::start; 47 this->quest_ = NULL; 45 48 } 46 49 … … 62 65 this->quest_->addListener(this); 63 66 64 COUT(3) << "QuestListener created for quest: {" << this->quest_->getId() << "} and status '" << this-> status_<< "'." << std::endl;67 COUT(3) << "QuestListener created for quest: {" << this->quest_->getId() << "} and status '" << this->getQuestStatus() << "'." << std::endl; 65 68 } 66 69 … … 80 83 { 81 84 this->fireEvent(true); //TDO This' right? 82 83 COUT(3) << "QuestListener fired Event, expect for something to happen." << std::endl; //TDO remove84 85 85 return true; 86 86 } -
code/branches/questsystem3/src/orxonox/objects/quest/QuestListener.h
r2329 r2346 80 80 questListenerStatus::Enum status_; 81 81 Quest* quest_; 82 BaseObject* target_;83 82 84 83 };
Note: See TracChangeset
for help on using the changeset viewer.