- Timestamp:
- Dec 5, 2008, 7:38:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.