Changeset 2911 for code/trunk/src/orxonox/objects/quest
- Timestamp:
- Apr 8, 2009, 2:58:40 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 36 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/questsystem5 (added) merged: 2777,2779,2781,2783,2785-2786,2788,2858
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/AddQuest.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/AddQuest.cc (added) merged: 2779,2785
r2910 r2911 28 28 29 29 /** 30 @file 30 @file AddQuest.cc 31 31 @brief Implementation of the AddQuest class. 32 32 */ … … 42 42 #include "orxonox/objects/infos/PlayerInfo.h" 43 43 #include "QuestManager.h" 44 #include "QuestDescription.h" 44 45 #include "Quest.h" 45 46 … … 72 73 { 73 74 SUPER(AddQuest, XMLPort, xmlelement, mode); 74 75 75 76 COUT(3) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl; 76 77 } … … 96 97 try 97 98 { 98 Quest* quest = QuestManager:: findQuest(this->getQuestId());99 Quest* quest = QuestManager::getInstance().findQuest(this->getQuestId()); 99 100 if(quest == NULL || !quest->start(player)) 100 101 { - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/AddQuest.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/AddQuest.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file AddQuest.h 31 31 @brief Definition of the AddQuest class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/AddQuestHint.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/AddQuestHint.cc (added) merged: 2779,2785
r2910 r2911 28 28 29 29 /** 30 @file 30 @file AddQuestHint.cc 31 31 @brief Implementation of the AddQuestHint class. 32 32 */ … … 117 117 try 118 118 { 119 QuestHint* hint = QuestManager:: findHint(this->hintId_);119 QuestHint* hint = QuestManager::getInstance().findHint(this->hintId_); 120 120 if(hint == NULL || !hint->setActive(player)) 121 121 { - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/AddQuestHint.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/AddQuestHint.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file AddQuestHint.h 31 31 @brief Definition of the AddQuestHint class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/AddReward.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/AddReward.cc (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file AddReward.cc 31 31 @brief Implementation of the AddReward class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/AddReward.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/AddReward.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file AddReward.h 31 31 @brief Definition of the AddReward class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/CMakeLists.txt
r2910 r2911 16 16 QuestListener.cc 17 17 QuestManager.cc 18 QuestNotification.cc 18 19 Rewardable.cc 19 20 ) -
code/trunk/src/orxonox/objects/quest/ChangeQuestStatus.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/ChangeQuestStatus.cc (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file ChangeQuestStatus.cc 31 31 @brief Implementation of the ChangeQuestStatus class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/ChangeQuestStatus.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/ChangeQuestStatus.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file ChangeQuestStatus.h 31 31 @brief Definition of the ChangeQuestStatus class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/CompleteQuest.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/CompleteQuest.cc (added) merged: 2779,2785
r2910 r2911 28 28 29 29 /** 30 @file 30 @file CompleteQuest.cc 31 31 @brief Implementation of the CompleteQuest class. 32 32 */ … … 96 96 try 97 97 { 98 quest = QuestManager:: findQuest(this->getQuestId());98 quest = QuestManager::getInstance().findQuest(this->getQuestId()); 99 99 if(quest == NULL || !quest->complete(player)) 100 100 { - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/CompleteQuest.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/CompleteQuest.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file CompleteQuest.h 31 31 @brief Definition of the CompleteQuest class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/FailQuest.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/FailQuest.cc (added) merged: 2779,2785
r2910 r2911 28 28 29 29 /** 30 @file 30 @file FailQuest.cc 31 31 @brief Implementation of the FailQuest class. 32 32 */ … … 95 95 try 96 96 { 97 quest = QuestManager:: findQuest(this->getQuestId());97 quest = QuestManager::getInstance().findQuest(this->getQuestId()); 98 98 if(quest == NULL || !quest->fail(player)) 99 99 { - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/FailQuest.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/FailQuest.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file FailQuest.h 31 31 @brief Definition of the FailQuest class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/GlobalQuest.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/GlobalQuest.cc (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file GlobalQuest.cc 31 31 @brief Implementation of the GlobalQuest class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/GlobalQuest.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/GlobalQuest.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file GlobalQuest.h 31 31 @brief Definition of the GlobalQuest class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/LocalQuest.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/LocalQuest.cc (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file LocalQuest.cc 31 31 @brief Implementation of the LocalQuest class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/LocalQuest.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/LocalQuest.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file LocalQuest.h 31 31 @brief Definition of the LocalQuest class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/Quest.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/Quest.cc (added) merged: 2779,2785
r2910 r2911 28 28 29 29 /** 30 @file 30 @file Quest.cc 31 31 @brief Implementation of the Quest class. 32 32 */ … … 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::getInstance().registerQuest(this); //!<Registers the Quest with the QuestManager. 82 82 } 83 83 - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/Quest.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/Quest.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file Quest.h 31 31 @brief Definition of the Quest class. 32 32 The Quest is the parent class of LocalQuest and GlobalQuest. - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/QuestDescription.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/QuestDescription.cc (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestDescription.cc 31 31 @brief Implementation of the QuestDescription class. 32 32 */ … … 37 37 38 38 #include "core/CoreIncludes.h" 39 #include " orxonox/overlays/notifications/Notification.h"39 #include "QuestNotification.h" 40 40 41 41 namespace orxonox … … 89 89 @return 90 90 Returns true if successful. 91 @todo 92 Make sure the messages meet the conditions. 91 93 */ 92 94 bool QuestDescription::notificationHelper(const std::string & item, const std::string & status) const 93 95 { 94 96 std::string message = ""; 95 std::string title = "";96 97 if(item == "hint") 97 98 { 98 title = "You received a hint: '" + this->title_ + "'"; 99 message = this->description_; 99 message = "You received a hint: '" + this->title_ + "'"; 100 100 } 101 101 else if(item == "quest") … … 103 103 if(status == "start") 104 104 { 105 title = "You received a new quest: '" + this->title_ + "'"; 106 message = this->description_; 105 message = "You received a new quest: '" + this->title_ + "'"; 107 106 } 108 107 else if(status == "fail") 109 108 { 110 title = "You failed the quest: '" + this->title_ + "'"; 111 message = this->failMessage_; 109 message = "You failed the quest: '" + this->title_ + "'"; 112 110 } 113 111 else if(status == "complete") 114 112 { 115 title = "You successfully completed the quest: '" + this->title_ + "'"; 116 message = this->completeMessage_; 113 message = "You successfully completed the quest: '" + this->title_ + "'"; 117 114 } 118 115 else … … 128 125 } 129 126 130 Notification* notification = new Notification(0, message, title, 30);127 QuestNotification* notification = new QuestNotification(message); 131 128 notification->send(); 132 129 return true; - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/QuestDescription.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/QuestDescription.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestDescription.h 31 31 @brief Definition of the QuestDescription class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/QuestEffect.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/QuestEffect.cc (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestEffect.cc 31 31 @brief Implementation of the QuestEffect class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/QuestEffect.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/QuestEffect.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestEffect.h 31 31 @brief Definition of the QuestEffect class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.cc
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestEffectBeacon.cc 31 31 @brief Implementation of the QuestEffectBeacon class. 32 32 */ -
code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.h
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestEffectBeacon.h 31 31 @brief Definition of the QuestEffectBeacon class. 32 32 */ -
code/trunk/src/orxonox/objects/quest/QuestHint.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/QuestHint.cc (added) merged: 2779,2785
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestHint.cc 31 31 @brief Implementation of the QuestHint class. 32 32 */ … … 73 73 SUPER(QuestHint, XMLPort, xmlelement, mode); 74 74 75 QuestManager:: registerHint(this); //!< Registers the QuestHint with the QuestManager.75 QuestManager::getInstance().registerHint(this); //!< Registers the QuestHint with the QuestManager. 76 76 77 77 COUT(3) << "New QuestHint {" << this->getId() << "} created." << std::endl; - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/QuestHint.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/QuestHint.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestHint.h 31 31 @brief Definition of the QuestHint class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/QuestItem.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/QuestItem.cc (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestItem.cc 31 31 @brief Implementation of the QuestItem class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/QuestItem.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/QuestItem.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestItem.h 31 31 @brief Definition of the QuestItem class. 32 32 The QuestItem is the parent class of Quest and QuestHint. - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/QuestListener.cc
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestListener.cc 31 31 @brief Implementation of the QuestListener class. 32 32 */ … … 112 112 bool QuestListener::setQuestId(const std::string & id) 113 113 { 114 this->quest_ = QuestManager:: findQuest(id); //!< Find the Quest corresponding to the given questId.114 this->quest_ = QuestManager::getInstance().findQuest(id); //!< Find the Quest corresponding to the given questId. 115 115 116 116 if(this->quest_ == NULL) //!< If there is no such Quest. -
code/trunk/src/orxonox/objects/quest/QuestListener.h
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestListener.h 31 31 @brief Definition of the QuestListener class. 32 32 */ -
code/trunk/src/orxonox/objects/quest/QuestManager.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/QuestManager.cc (added) merged: 2779,2785-2786,2788
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestManager.cc 31 31 @brief Implementation of the QuestManager class. 32 32 */ … … 43 43 namespace orxonox 44 44 { 45 //! All Quests registered by their id's. 46 std::map<std::string, Quest*> QuestManager::questMap_s; 47 //! All QuestHints registered by their id's. 48 std::map<std::string, QuestHint*> QuestManager::hintMap_s; 45 //! Pointer to the current (and single) instance of this class. 46 QuestManager* QuestManager::singletonRef_s = NULL; 49 47 50 48 /** 51 49 @brief 52 50 Constructor. Registers the object. 53 */ 54 QuestManager::QuestManager(BaseObject* creator) : BaseObject(creator) 55 { 56 RegisterObject(QuestManager); 51 @todo 52 Is inheriting from BaseObject proper? 53 */ 54 QuestManager::QuestManager() 55 { 56 RegisterRootObject(QuestManager); 57 58 assert(singletonRef_s == 0); 59 singletonRef_s = this; 57 60 } 58 61 … … 64 67 { 65 68 69 } 70 71 /** 72 @brief 73 Returns a reference to the current (and single) instance of the QuestManager, and creates one if there isn't one to begin with. 74 @return 75 Returns a reference to the single instance of the Quest Manager. 76 */ 77 /*static*/ QuestManager & QuestManager::getInstance() 78 { 79 assert(singletonRef_s); 80 return *singletonRef_s; 66 81 } 67 82 … … 75 90 Returns true if successful, false if not. 76 91 */ 77 /*static*/bool QuestManager::registerQuest(Quest* quest)92 bool QuestManager::registerQuest(Quest* quest) 78 93 { 79 94 if(quest == NULL) //!< Doh! Just as if there were actual quests behind NULL-pointers. … … 84 99 85 100 std::pair<std::map<std::string, Quest*>::iterator,bool> result; 86 result = questMap_s.insert( std::pair<std::string,Quest*>(quest->getId(),quest) ); //!< Inserting the Quest.101 result = this->questMap_.insert( std::pair<std::string,Quest*>(quest->getId(),quest) ); //!< Inserting the Quest. 87 102 88 103 if(result.second) //!< If inserting was a success. … … 107 122 Returns true if successful, false if not. 108 123 */ 109 /*static*/bool QuestManager::registerHint(QuestHint* hint)124 bool QuestManager::registerHint(QuestHint* hint) 110 125 { 111 126 if(hint == NULL) //!< Still not liking NULL-pointers. … … 116 131 117 132 std::pair<std::map<std::string, QuestHint*>::iterator,bool> result; 118 result = hintMap_s.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) ); //!< Inserting the QuestHSint.133 result = this->hintMap_.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) ); //!< Inserting the QuestHSint. 119 134 120 135 if(result.second) //!< If inserting was a success. … … 141 156 Throws an exception if the given questId is invalid. 142 157 */ 143 /*static*/Quest* QuestManager::findQuest(const std::string & questId)158 Quest* QuestManager::findQuest(const std::string & questId) 144 159 { 145 160 if(!QuestItem::isId(questId)) //!< Check vor validity of the given id. … … 149 164 150 165 Quest* quest; 151 std::map<std::string, Quest*>::iterator it = questMap_s.find(questId);152 if (it != questMap_s.end()) //!< If the Quest is registered.166 std::map<std::string, Quest*>::iterator it = this->questMap_.find(questId); 167 if (it != this->questMap_.end()) //!< If the Quest is registered. 153 168 { 154 169 quest = it->second; … … 175 190 Throws an exception if the given hintId is invalid. 176 191 */ 177 /*static*/QuestHint* QuestManager::findHint(const std::string & hintId)192 QuestHint* QuestManager::findHint(const std::string & hintId) 178 193 { 179 194 if(!QuestItem::isId(hintId)) //!< Check vor validity of the given id. … … 183 198 184 199 QuestHint* hint; 185 std::map<std::string, QuestHint*>::iterator it = hintMap_s.find(hintId);186 if (it != hintMap_s.end()) //!< If the QuestHint is registered.200 std::map<std::string, QuestHint*>::iterator it = this->hintMap_.find(hintId); 201 if (it != this->hintMap_.end()) //!< If the QuestHint is registered. 187 202 { 188 203 hint = it->second; - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/QuestManager.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/QuestManager.h (added) merged: 2779,2785-2786,2788
r2910 r2911 28 28 29 29 /** 30 @file 30 @file QuestManager.h 31 31 @brief Definition of the QuestManager class. 32 32 */ … … 40 40 #include <string> 41 41 42 #include "core/ BaseObject.h"42 #include "core/OrxonoxClass.h" 43 43 44 44 namespace orxonox … … 46 46 /** 47 47 @brief 48 Is a static classand manages Quests, by registering every Quest/QuestHint (through registerX()) and making them globally accessable (through findX()).48 Is a Singleton and manages Quests, by registering every Quest/QuestHint (through registerX()) and making them globally accessable (through findX()). 49 49 Quests (and QuestHints) are registered in the QuestManager with their id, and can be accessed in the same way. 50 50 @author 51 51 Damian 'Mozork' Frick 52 52 */ 53 class _OrxonoxExport QuestManager : public BaseObject53 class _OrxonoxExport QuestManager : public OrxonoxClass 54 54 { 55 56 55 public: 57 QuestManager( BaseObject* creator);56 QuestManager(); 58 57 virtual ~QuestManager(); 59 58 60 static bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager. 61 static bool registerHint(QuestHint* quest); //!< Registers a QuestHint in the QuestManager. 59 static QuestManager& getInstance(); //!< Returns a reference to the single instance of the Quest Manager. 62 60 63 static Quest* findQuest(const std::string & questId); //!< Returns the Quest with the input id. 64 static QuestHint* findHint(const std::string & hintId); //!< Returns the QuestHint with the input id. 61 bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager. 62 bool registerHint(QuestHint* quest); //!< Registers a QuestHint in the QuestManager. 63 64 Quest* findQuest(const std::string & questId); //!< Returns the Quest with the input id. 65 QuestHint* findHint(const std::string & hintId); //!< Returns the QuestHint with the input id. 65 66 66 67 private: 67 static std::map<std::string, Quest*> questMap_s; //!< All Quests registered by their id's. 68 static std::map<std::string, QuestHint*> hintMap_s; //!< All QuestHints registered by their id's. 68 static QuestManager* singletonRef_s; 69 70 std::map<std::string, Quest*> questMap_; //!< All Quests registered by their id's. 71 std::map<std::string, QuestHint*> hintMap_; //!< All QuestHints registered by their id's. 69 72 70 73 }; - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/Rewardable.cc
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/Rewardable.cc (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file Rewardable.cc 31 31 @brief Implementation of the Rewardable class. 32 32 */ - Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/quest/Rewardable.h
- Property svn:mergeinfo changed
/code/branches/questsystem5/src/orxonox/objects/quest/Rewardable.h (added) merged: 2779
r2910 r2911 28 28 29 29 /** 30 @file 30 @file Rewardable.h 31 31 @brief Definition of the Rewardable class. 32 32 */ - Property svn:mergeinfo changed
Note: See TracChangeset
for help on using the changeset viewer.