Changeset 6945 for code/branches/presentation3/src/modules
- Timestamp:
- May 20, 2010, 10:36:48 PM (15 years ago)
- Location:
- code/branches/presentation3/src/modules/questsystem
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/modules/questsystem/AddQuest.cc
r5781 r6945 68 68 SUPER(AddQuest, XMLPort, xmlelement, mode); 69 69 70 COUT( 3) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;70 COUT(4) << "New AddQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl; 71 71 } 72 72 … … 87 87 } 88 88 89 COUT( 3) << "AddQuest on player: " << player << " ." << std::endl;89 COUT(5) << "AddQuest on player: " << player << " ." << std::endl; 90 90 91 91 try … … 103 103 } 104 104 105 COUT( 3) << "Quest {" << this->getQuestId() << "} successfully added to player: " << player << " ." << std::endl;105 COUT(4) << "Quest {" << this->getQuestId() << "} successfully added to player: " << player << " ." << std::endl; 106 106 return true; 107 107 } -
code/branches/presentation3/src/modules/questsystem/AddQuestHint.cc
r6940 r6945 72 72 XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode); 73 73 74 COUT( 3) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl;74 COUT(4) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl; 75 75 } 76 76 … … 111 111 } 112 112 113 COUT( 3) << "AddQuestHint on player: " << player << " ." << std::endl;113 COUT(5) << "AddQuestHint on player: " << player << " ." << std::endl; 114 114 115 115 try … … 127 127 } 128 128 129 COUT( 3) << "QuestHint {" << this->getHintId() << "} successfully added to player: " << player << " ." << std::endl;129 COUT(4) << "QuestHint {" << this->getHintId() << "} successfully added to player: " << player << " ." << std::endl; 130 130 return true; 131 131 -
code/branches/presentation3/src/modules/questsystem/AddReward.cc
r6417 r6945 68 68 XMLPortObject(AddReward, Rewardable, "", addRewardable, getRewardables, xmlelement, mode); 69 69 70 COUT( 3) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << std::endl;70 COUT(4) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << std::endl; 71 71 } 72 72 … … 103 103 bool AddReward::invoke(PlayerInfo* player) 104 104 { 105 COUT( 3) << "AddReward on player: " << player << " ." << std::endl;105 COUT(5) << "AddReward on player: " << player << " ." << std::endl; 106 106 107 107 bool check = true; … … 111 111 } 112 112 113 COUT( 3) << "Rewardable successfully added to player." << player << " ." << std::endl;113 COUT(4) << "Rewardable successfully added to player." << player << " ." << std::endl; 114 114 115 115 return check; -
code/branches/presentation3/src/modules/questsystem/CompleteQuest.cc
r6417 r6945 68 68 SUPER(CompleteQuest, XMLPort, xmlelement, mode); 69 69 70 COUT( 3) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;70 COUT(4) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl; 71 71 } 72 72 … … 87 87 } 88 88 89 COUT( 3) << "CompleteQuest on player: " << player << " ." << std::endl;89 COUT(5) << "CompleteQuest on player: " << player << " ." << std::endl; 90 90 91 91 Quest* quest; … … 105 105 } 106 106 107 COUT( 3) << "Quest {" << quest->getId() << "} successfully completed by player: " << player << " ." << std::endl;107 COUT(4) << "Quest {" << quest->getId() << "} successfully completed by player: " << player << " ." << std::endl; 108 108 return true; 109 109 } -
code/branches/presentation3/src/modules/questsystem/FailQuest.cc
r6417 r6945 68 68 SUPER(FailQuest, XMLPort, xmlelement, mode); 69 69 70 COUT( 3) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;70 COUT(4) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl; 71 71 } 72 72 … … 87 87 } 88 88 89 COUT( 3) << "FailQuest on player: " << player << " ." << std::endl;89 COUT(4) << "FailQuest on player: " << player << " ." << std::endl; 90 90 91 91 Quest* quest; … … 104 104 } 105 105 106 COUT( 3) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl;106 COUT(4) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl; 107 107 return true; 108 108 } -
code/branches/presentation3/src/modules/questsystem/GlobalQuest.cc
r6417 r6945 70 70 XMLPortObject(GlobalQuest, QuestEffect, "reward-effects", addRewardEffect, getRewardEffects, xmlelement, mode); 71 71 72 COUT( 3) << "New GlobalQuest {" << this->getId() << "} created." << std::endl;72 COUT(4) << "New GlobalQuest {" << this->getId() << "} created." << std::endl; 73 73 } 74 74 … … 253 253 this->rewards_.push_back(effect); //!< Add the QuestEffect to the list. 254 254 255 COUT( 3) << "Reward effect was added to Quest {" << this->getId() << "}." << std::endl;255 COUT(4) << "Reward effect was added to Quest {" << this->getId() << "}." << std::endl; 256 256 return true; 257 257 } -
code/branches/presentation3/src/modules/questsystem/LocalQuest.cc
r6417 r6945 68 68 SUPER(LocalQuest, XMLPort, xmlelement, mode); 69 69 70 COUT( 3) << "New LocalQuest {" << this->getId() << "} created." << std::endl;70 COUT(4) << "New LocalQuest {" << this->getId() << "} created." << std::endl; 71 71 } 72 72 -
code/branches/presentation3/src/modules/questsystem/Quest.cc
r6940 r6945 99 99 this->parentQuest_ = quest; 100 100 101 COUT( 3) << "Parent Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;101 COUT(4) << "Parent Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl; 102 102 return true; 103 103 } … … 122 122 this->subQuests_.push_back(quest); //!< Adds the Quest to the end of the list of subquests. 123 123 124 COUT( 3) << "Sub Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;124 COUT(4) << "Sub Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl; 125 125 return true; 126 126 } … … 146 146 this->hints_.push_back(hint); //!< Adds the QuestHint to the end of the list of QuestHints. 147 147 148 COUT( 3) << "QuestHint {" << hint->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;148 COUT(4) << "QuestHint {" << hint->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl; 149 149 return true; 150 150 } … … 168 168 this->failEffects_.push_back(effect); //!< Adds the QuestEffect to the end of the list of fail QuestEffects. 169 169 170 COUT( 3) << "A FailEffect was added to Quest {" << this->getId() << "}." << std::endl;170 COUT(4) << "A FailEffect was added to Quest {" << this->getId() << "}." << std::endl; 171 171 return true; 172 172 } … … 190 190 this->completeEffects_.push_back(effect); //!< Adds the QuestEffect to the end of the list of complete QuestEffects. 191 191 192 COUT( 3) << "A CompleteEffect was added to Quest {" << this->getId() << "}." << std::endl;192 COUT(4) << "A CompleteEffect was added to Quest {" << this->getId() << "}." << std::endl; 193 193 return true; 194 194 } -
code/branches/presentation3/src/modules/questsystem/QuestDescription.cc
r6417 r6945 74 74 XMLPortParam(QuestDescription, "completeMessage", setCompleteMessage, getCompleteMessage, xmlelement, mode); 75 75 76 COUT( 3) << "New QuestDescription with title '" << this->getTitle() << "' created." << std::endl;76 COUT(4) << "New QuestDescription with title '" << this->getTitle() << "' created." << std::endl; 77 77 } 78 78 … … 89 89 Make sure the messages meet the conditions. 90 90 */ 91 bool QuestDescription::notificationHelper(const std::string & item, const std::string & status) const91 bool QuestDescription::notificationHelper(const std::string & item, const std::string & status) 92 92 { 93 93 std::string message; … … 122 122 } 123 123 124 QuestNotification* notification = new QuestNotification( message);124 QuestNotification* notification = new QuestNotification(this, message); 125 125 notification->send(); 126 126 return true; -
code/branches/presentation3/src/modules/questsystem/QuestDescription.h
r5781 r6945 83 83 @return Returns a string containing the fail message of the QuestDescription. 84 84 */ 85 inline const std::string & getFailMessage(void) const85 inline const std::string & getFailMessage(void) 86 86 { return this->failMessage_; } 87 87 … … 90 90 @return Returns a string containing the complete message of the QuestDescription. 91 91 */ 92 inline const std::string & getCompleteMessage(void) const92 inline const std::string & getCompleteMessage(void) 93 93 { return this->completeMessage_; } 94 94 … … 97 97 @return Returns true if successful. 98 98 */ 99 inline bool sendAddHintNotification(void) const99 inline bool sendAddHintNotification(void) 100 100 { return notificationHelper("hint", ""); } 101 101 … … 104 104 @return Returns true if successful. 105 105 */ 106 inline bool sendAddQuestNotification(void) const106 inline bool sendAddQuestNotification(void) 107 107 { return notificationHelper("quest", "start"); } 108 108 … … 111 111 @return Returns true if successful. 112 112 */ 113 inline bool sendFailQuestNotification(void) const113 inline bool sendFailQuestNotification(void) 114 114 { return notificationHelper("quest", "fail"); } 115 115 … … 118 118 @return Returns true if successful. 119 119 */ 120 inline bool sendCompleteQuestNotification(void) const120 inline bool sendCompleteQuestNotification(void) 121 121 { return notificationHelper("quest", "complete"); } 122 122 … … 127 127 std::string completeMessage_; //!< The message displayed when the Quest is completed. 128 128 129 bool notificationHelper(const std::string & item, const std::string & status) const; //!< Helper for sending QuestDescriptions as Notifications.129 bool notificationHelper(const std::string & item, const std::string & status); //!< Helper for sending QuestDescriptions as Notifications. 130 130 131 131 /** -
code/branches/presentation3/src/modules/questsystem/QuestEffectBeacon.cc
r6935 r6945 78 78 XMLPortEventSink(QuestEffectBeacon, BaseObject, "execute", execute, xmlelement, mode); //TODO: Change BaseObject to MultiTrigger as soon as MultiTrigger is the base of all triggers. 79 79 80 COUT( 3) << "New QuestEffectBeacon created." << std::endl;80 COUT(4) << "New QuestEffectBeacon created." << std::endl; 81 81 } 82 82 … … 134 134 if(pawn == NULL) 135 135 { 136 COUT( 2) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl;136 COUT(4) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl; 137 137 return false; 138 138 } … … 147 147 } 148 148 149 COUT( 3) << "QuestEffectBeacon executed on player: " << player << " ." << std::endl;149 COUT(4) << "QuestEffectBeacon executed on player: " << player << " ." << std::endl; 150 150 151 151 bool check = QuestEffect::invokeEffects(player, this->effects_); //!< Invoke the QuestEffects on the PlayerInfo. … … 249 249 this->effects_.push_back(effect); 250 250 251 COUT( 3) << "A QuestEffect was added to a QuestEffectBeacon." << std::endl;251 COUT(4) << "A QuestEffect was added to a QuestEffectBeacon." << std::endl; 252 252 return true; 253 253 } -
code/branches/presentation3/src/modules/questsystem/QuestGUI.cc
r6746 r6945 101 101 void QuestGUI::update(void) 102 102 { 103 COUT( 3) << "Updating QuestGUI..." << std::endl;103 COUT(4) << "Updating QuestGUI..." << std::endl; 104 104 105 105 this->clear(); //!< Clear the GUI. … … 122 122 } 123 123 } 124 COUT( 3) << "Updating QuestGUI done." << std::endl;124 COUT(4) << "Updating QuestGUI done." << std::endl; 125 125 } 126 126 … … 131 131 void QuestGUI::clear(void) 132 132 { 133 COUT( 3) << "Clearing QuestGUI..." << std::endl;133 COUT(4) << "Clearing QuestGUI..." << std::endl; 134 134 135 135 //! Clear all nodes. -
code/branches/presentation3/src/modules/questsystem/QuestGUINode.cc
r6746 r6945 81 81 this->createWindow(); 82 82 83 COUT( 3) << "New QuestGUINode '" << this->window_->getName() << "' created." << std::endl;83 COUT(4) << "New QuestGUINode '" << this->window_->getName() << "' created." << std::endl; 84 84 } 85 85 … … 269 269 } 270 270 271 COUT( 3) << "Show Details: " << this->details_->getName() << std::endl;271 COUT(4) << "Show Details: " << this->details_->getName() << std::endl; 272 272 } 273 273 … … 281 281 bool QuestGUINode::openDetails(const CEGUI::EventArgs& e) 282 282 { 283 COUT( 3) << "Open QuestItem..." << std::endl;283 COUT(4) << "Open QuestItem..." << std::endl; 284 284 285 285 //CEGUI::Window* window = this->gui_->getRootWindow(); -
code/branches/presentation3/src/modules/questsystem/QuestHint.cc
r6940 r6945 73 73 QuestManager::getInstance().registerHint(this); //!< Registers the QuestHint with the QuestManager. 74 74 75 COUT( 3) << "New QuestHint {" << this->getId() << "} created." << std::endl;75 COUT(4) << "New QuestHint {" << this->getId() << "} created." << std::endl; 76 76 } 77 77 … … 126 126 else 127 127 { 128 COUT( 2) << "An already active questHint was trying to get activated." << std::endl;128 COUT(4) << "An already active questHint was trying to get activated." << std::endl; 129 129 return false; 130 130 } 131 131 } 132 132 133 COUT( 2) << "A hint of a non-active quest was trying to get activated." << std::endl;133 COUT(4) << "A hint of a non-active quest was trying to get activated." << std::endl; 134 134 return false; 135 135 } -
code/branches/presentation3/src/modules/questsystem/QuestItem.cc
r6940 r6945 40 40 namespace orxonox 41 41 { 42 43 CreateUnloadableFactory(QuestItem); 44 42 45 /** 43 46 @brief -
code/branches/presentation3/src/modules/questsystem/QuestItem.h
r6940 r6945 72 72 @return Returns a pointer to the QuestDescription object of the QuestItem. 73 73 */ 74 inline constQuestDescription* getDescription(void) const74 inline QuestDescription* getDescription(void) const 75 75 { return this->description_; } 76 76 -
code/branches/presentation3/src/modules/questsystem/QuestListener.cc
r6940 r6945 77 77 this->quest_->addListener(this); //!< Adds the QuestListener to the Quests list of listeners. 78 78 79 COUT( 3) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << std::endl;79 COUT(4) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << std::endl; 80 80 } 81 81 -
code/branches/presentation3/src/modules/questsystem/QuestManager.cc
r6940 r6945 115 115 { 116 116 quest->setRegistered(); 117 COUT( 3) << "Quest with questId {" << quest->getId() << "} successfully inserted." << std::endl;117 COUT(4) << "Quest with questId {" << quest->getId() << "} successfully inserted." << std::endl; 118 118 return true; 119 119 } … … 157 157 { 158 158 hint->setRegistered(); 159 COUT( 3) << "QuestHint with hintId {" << hint->getId() << "} successfully inserted." << std::endl;159 COUT(4) << "QuestHint with hintId {" << hint->getId() << "} successfully inserted." << std::endl; 160 160 return true; 161 161 } -
code/branches/presentation3/src/modules/questsystem/QuestNotification.cc
r6417 r6945 32 32 namespace orxonox { 33 33 34 const std::string QuestNotification::SENDER("questsystem");34 /*static*/ const std::string QuestNotification::SENDER("questsystem"); 35 35 36 CreateUnloadableFactory(QuestNotification); 37 38 /** 39 @brief 40 Default Constructor. Creates a useless QuestNotification. 41 */ 36 42 QuestNotification::QuestNotification(BaseObject* creator) : Notification(creator) 37 43 { 38 this->initialize();44 RegisterObject(QuestNotification); 39 45 } 40 46 41 QuestNotification::QuestNotification(const std::string & message) : Notification(message) 47 /** 48 @brief 49 Creates a QuestNotification with the input message. 50 @param message 51 The message to be sent. 52 */ 53 QuestNotification::QuestNotification(BaseObject* creator, const std::string & message) : Notification(creator, message) 42 54 { 43 this->initialize();55 RegisterObject(QuestNotification); 44 56 } 45 57 58 /** 59 @brief 60 Destructor. 61 */ 46 62 QuestNotification::~QuestNotification() 47 63 { … … 49 65 } 50 66 67 /** 68 @brief 69 Send the QuestNotification. 70 @return 71 Returns true if successful. 72 */ 51 73 bool QuestNotification::send(void) 52 74 { … … 54 76 } 55 77 56 void QuestNotification::initialize(void)57 {58 RegisterObject(QuestNotification);59 }60 61 78 62 79 } -
code/branches/presentation3/src/modules/questsystem/QuestNotification.h
r5781 r6945 39 39 /** 40 40 @brief 41 41 The QuestNotification is a special Notification that has the single property that it is only sent by the questsystem. 42 42 @author 43 43 Damian 'Mozork' Frick … … 46 46 { 47 47 public: 48 QuestNotification(BaseObject* creator); 49 QuestNotification( const std::string & message);50 virtual ~QuestNotification(); 48 QuestNotification(BaseObject* creator); //!< Default Constructor. 49 QuestNotification(BaseObject* creator, const std::string & message); //!< Constructor. 50 virtual ~QuestNotification(); //!< Destructor. 51 51 52 bool send(void); 52 bool send(void); //!< Send the QuestNotification. 53 53 54 54 private: 55 static const std::string SENDER; 56 57 void initialize(void); 55 static const std::string SENDER; //!< A string identifying the questsystem as the sender. 58 56 59 57 }; -
code/branches/presentation3/src/modules/questsystem/notifications/Notification.cc
r6417 r6945 40 40 { 41 41 42 CreateUnloadableFactory(Notification); 43 42 44 /** 43 45 @brief … … 56 58 The message of the Notification. 57 59 */ 58 Notification::Notification( const std::string & message) : BaseObject(NULL)60 Notification::Notification(BaseObject* creator, const std::string & message) : BaseObject(creator) 59 61 { 60 62 this->message_ = message; … … 67 69 Notification::~Notification() 68 70 { 71 69 72 } 70 73 -
code/branches/presentation3/src/modules/questsystem/notifications/Notification.h
r5781 r6945 53 53 public: 54 54 Notification(BaseObject* creator); 55 Notification( const std::string & message);55 Notification(BaseObject* creator, const std::string & message); 56 56 virtual ~Notification(); 57 57 -
code/branches/presentation3/src/modules/questsystem/notifications/NotificationManager.cc
r6944 r6945 118 118 @brief 119 119 Unregisters a Notification within the NotificationManager. 120 @param notification 121 A pointer to the Notification to be unregistered. 122 @param listener 123 A pointer to the NotificationListener the Notification is unregistered for. 120 124 */ 121 125 void NotificationManager::unregisterNotification(Notification* notification, NotificationListener* listener) … … 124 128 assert(listener); 125 129 130 // If the Notification was removed from the list of Notifications of the input NotificationListener, the counter for the Notification of the number of NotificationListeners it is present in is decremented. 126 131 if(this->removeNotification(notification, *(this->notificationLists_.find(this->listenerList_.find(listener)->second)->second))) 127 132 this->listenerCounter_[notification] = this->listenerCounter_[notification] - 1; 133 134 // If the Notification is no longer present in any of the NotificationListeners it can be removed from the map of all Notifications and be destroyed. 128 135 if(this->listenerCounter_[notification] == (unsigned int) 0) 129 136 { 130 137 this->removeNotification(notification, this->allNotificationsList_); 138 this->listenerCounter_.erase(notification); 131 139 notification->destroy(); 132 140 } … … 138 146 @brief 139 147 Helper method that removes an input notification form an input map. 148 @param notification 149 A pointer to the notification to be removed. 150 @param map 151 The map the notification should be removed from. 152 @return 153 Returns true if successful. 140 154 */ 141 155 bool NotificationManager::removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map) 142 156 { 157 // Iterates through all items in the map until the Notification is found. 158 //TODO: Do more efficiently? 143 159 for(std::multimap<std::time_t, Notification*>::iterator it = map.begin(); it != map.end(); it++) 144 160 { … … 222 238 this->listenerList_.erase(listener); 223 239 this->notificationLists_.erase(identifier); 224 delete map; 240 241 // If the map is not the map of all notifications, delete it. 242 if(map != &this->allNotificationsList_) 243 delete map; 225 244 226 245 COUT(4) << "NotificationListener unregistered with the NotificationManager." << std::endl; -
code/branches/presentation3/src/modules/questsystem/notifications/NotificationManager.h
r6944 r6945 60 60 virtual ~NotificationManager(); 61 61 62 static const std::string ALL; 63 static const std::string NONE; 62 static const std::string ALL; //!< Static string to indicate a sender that sends to all NotificationListeners. 63 static const std::string NONE; //!< Static string to indicare a sender that sends to no specific NotificationListener. 64 64 65 65 bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager. … … 99 99 std::map<Notification*, unsigned int> listenerCounter_; //!< A container to store the number of NotificationListeners a Notification is registered with. 100 100 101 bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); 102 101 bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); //!< Helper method that removes an input notification form an input map. 103 102 104 103 }; -
code/branches/presentation3/src/modules/questsystem/notifications/NotificationQueue.cc
r6944 r6945 124 124 XMLPortParam(NotificationQueue, "position", setPosition, getPosition, xmlElement, mode); 125 125 126 COUT(3) << "NotificationQueue created." << std::endl;126 COUT(3) << "NotificationQueue '" << this->getName() << "' created." << std::endl; 127 127 } 128 128 … … 179 179 delete notifications; 180 180 181 COUT( 3) << "NotificationQueueupdated." << std::endl;181 COUT(4) << "NotificationQueue '" << this->getName() << "' updated." << std::endl; 182 182 } 183 183 … … 202 202 } 203 203 204 COUT( 3) << "NotificationQueueupdated. A new Notifications has been added." << std::endl;204 COUT(4) << "NotificationQueue '" << this->getName() << "' updated. A new Notifications has been added." << std::endl; 205 205 } 206 206 … … 429 429 return false; 430 430 431 // Unregister the NotificationQueue with the NotificationManager. 431 432 NotificationManager::getInstance().unregisterNotification(container->notification, this); 432 433 -
code/branches/presentation3/src/modules/questsystem/notifications/NotificationQueue.h
r6944 r6945 71 71 72 72 Creating a NotificationQueue through XML goes as follows: 73 Be aware that the NotificationQueue must be inside the <Level></Level> tags or bad things will happen. 73 74 <NotificationQueue 74 75 name = "SuperQueue" //Name of your OverlayQueue.
Note: See TracChangeset
for help on using the changeset viewer.