Changeset 6387 for code/branches/presentation2/src/modules/questsystem
- Timestamp:
- Dec 21, 2009, 1:18:36 PM (15 years ago)
- Location:
- code/branches/presentation2/src/modules/questsystem
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/modules/questsystem/AddQuestHint.cc
r5781 r6387 71 71 72 72 XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode); 73 73 74 74 COUT(3) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl; 75 75 } … … 90 90 return false; 91 91 } 92 92 93 93 this->hintId_ = id; 94 94 return true; -
code/branches/presentation2/src/modules/questsystem/AddReward.cc
r5781 r6387 67 67 68 68 XMLPortObject(AddReward, Rewardable, "", addRewardable, getRewardables, xmlelement, mode); 69 69 70 70 COUT(3) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << std::endl; 71 71 } … … 104 104 { 105 105 COUT(3) << "AddReward on player: " << player << " ." << std::endl; 106 106 107 107 bool check = true; 108 108 for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward ) … … 110 110 check = check && (*reward)->reward(player); 111 111 } 112 112 113 113 COUT(3) << "Rewardable successfully added to player." << player << " ." << std::endl; 114 114 -
code/branches/presentation2/src/modules/questsystem/ChangeQuestStatus.cc
r5781 r6387 83 83 return false; 84 84 } 85 85 86 86 this->questId_ = id; 87 87 return true; -
code/branches/presentation2/src/modules/questsystem/CompleteQuest.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 67 67 { 68 68 SUPER(CompleteQuest, XMLPort, xmlelement, mode); 69 69 70 70 COUT(3) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl; 71 71 } -
code/branches/presentation2/src/modules/questsystem/FailQuest.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 67 67 { 68 68 SUPER(FailQuest, XMLPort, xmlelement, mode); 69 69 70 70 COUT(3) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl; 71 71 } … … 103 103 return false; 104 104 } 105 105 106 106 COUT(3) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl; 107 107 return true; -
code/branches/presentation2/src/modules/questsystem/GlobalQuest.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 59 59 60 60 } 61 61 62 62 /** 63 63 @brief … … 67 67 { 68 68 SUPER(GlobalQuest, XMLPort, xmlelement, mode); 69 69 70 70 XMLPortObject(GlobalQuest, QuestEffect, "reward-effects", addRewardEffect, getRewardEffects, xmlelement, mode); 71 71 72 72 COUT(3) << "New GlobalQuest {" << this->getId() << "} created." << std::endl; 73 73 } 74 74 75 75 /** 76 76 @brief … … 89 89 return false; 90 90 } 91 91 92 92 Quest::fail(player); 93 93 94 94 //! Iterate through all players possessing this Quest. 95 95 for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++) … … 118 118 return false; 119 119 } 120 120 121 121 //! Iterate through all players possessing the Quest. 122 122 for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++) … … 124 124 QuestEffect::invokeEffects(*it, this->getCompleteEffectList()); 125 125 } 126 126 127 127 Quest::complete(player); 128 128 129 129 QuestEffect::invokeEffects(player, this->rewards_); //!< Invoke reward QuestEffects on the player completing the Quest. 130 130 return true; … … 230 230 this->players_.insert(player); //!< Add the player to the set. 231 231 } 232 232 233 233 this->status_ = status; //!< Set the status, which is global, remember...? 234 234 return true; 235 235 } 236 236 237 237 /** 238 238 @brief … … 256 256 return true; 257 257 } 258 258 259 259 /** 260 260 @brief -
code/branches/presentation2/src/modules/questsystem/LocalQuest.cc
r5781 r6387 87 87 return false; 88 88 } 89 89 90 90 Quest::fail(player); 91 91 92 92 QuestEffect::invokeEffects(player, this->getFailEffectList()); //!< Invoke the failEffects. 93 93 return true; … … 110 110 return false; 111 111 } 112 112 113 113 Quest::complete(player); 114 114 115 115 QuestEffect::invokeEffects(player, this->getCompleteEffectList()); //!< Invoke the complete QuestEffects. 116 116 return true; … … 188 188 return it->second; 189 189 } 190 190 191 191 return QuestStatus::Inactive; //!< If the player is not yet in the map, that means the status of the quest form him is 'inactive'. 192 192 } … … 209 209 return false; 210 210 } 211 211 212 212 this->playerStatus_[player] = status; 213 213 return true; -
code/branches/presentation2/src/modules/questsystem/Quest.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 204 204 { 205 205 int i = index; 206 206 207 207 //! Iterate through all subquests. 208 208 for (std::list<Quest*>::const_iterator subQuest = this->subQuests_.begin(); subQuest != this->subQuests_.end(); ++subQuest) … … 214 214 i--; 215 215 } 216 216 217 217 return NULL; //!< If the index is greater than the number of elements in the list. 218 218 } … … 229 229 { 230 230 int i = index; 231 231 232 232 //! Iterate through all QuestHints. 233 233 for (std::list<QuestHint*>::const_iterator hint = this->hints_.begin(); hint != this->hints_.end(); ++hint) … … 253 253 { 254 254 int i = index; 255 255 256 256 //! Iterate through all fail QuestEffects. 257 257 for (std::list<QuestEffect*>::const_iterator effect = this->failEffects_.begin(); effect != this->failEffects_.end(); ++effect) … … 277 277 { 278 278 int i = index; 279 279 280 280 //! Iterate through all complete QuestEffects. 281 281 for (std::list<QuestEffect*>::const_iterator effect = this->completeEffects_.begin(); effect != this->completeEffects_.end(); ++effect) … … 350 350 return this->getStatus(player) == QuestStatus::Completed; 351 351 } 352 352 353 353 /** 354 354 @brief … … 363 363 QuestListener::advertiseStatusChange(this->listeners_, "fail"); //!< Tells the QuestListeners, that the status has changed to failed. 364 364 this->setStatus(player, QuestStatus::Failed); 365 365 366 366 COUT(4) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." <<std::endl; 367 367 368 368 this->getDescription()->sendFailQuestNotification(); 369 369 return true; 370 370 } 371 371 372 372 /** 373 373 @brief … … 382 382 QuestListener::advertiseStatusChange(this->listeners_, "complete"); //!< Tells the QuestListeners, that the status has changed to completed. 383 383 this->setStatus(player, QuestStatus::Completed); 384 384 385 385 COUT(4) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." <<std::endl; 386 386 387 387 this->getDescription()->sendCompleteQuestNotification(); 388 388 return true; … … 404 404 return false; 405 405 } 406 406 407 407 COUT(4) << "Quest {" << this->getId() << "} is started for player: " << player << " ." <<std::endl; 408 408 409 409 QuestListener::advertiseStatusChange(this->listeners_, "start"); //!< Tells the QuestListeners, that the status has changed to active. 410 410 411 411 this->setStatus(player, QuestStatus::Active); 412 412 413 413 this->getDescription()->sendAddQuestNotification(); 414 414 return true; 415 415 } 416 416 417 417 /** 418 418 @brief … … 430 430 return false; 431 431 } 432 432 433 433 this->listeners_.push_back(listener); 434 434 return true; -
code/branches/presentation2/src/modules/questsystem/QuestDescription.cc
r5781 r6387 50 50 { 51 51 RegisterObject(QuestDescription); 52 52 53 53 this->title_ = ""; 54 54 this->description_ = ""; … … 79 79 COUT(3) << "New QuestDescription with title '" << this->getTitle() << "' created." << std::endl; 80 80 } 81 81 82 82 /** 83 83 @brief … … 124 124 return false; 125 125 } 126 126 127 127 QuestNotification* notification = new QuestNotification(message); 128 128 notification->send(); -
code/branches/presentation2/src/modules/questsystem/QuestEffect.cc
r5781 r6387 69 69 { 70 70 bool check = true; 71 71 72 72 COUT(4) << "Invoking QuestEffects on player: " << player << " ." << std::endl; 73 73 -
code/branches/presentation2/src/modules/questsystem/QuestGUI.cc
r5929 r6387 77 77 } 78 78 this->windows_.clear(); 79 79 80 80 if(this->root_ != NULL) 81 81 this->root_->destroy(); … … 104 104 105 105 this->clear(); //!< Clear the GUI. 106 106 107 107 int depth = 0; 108 108 int index = 0; … … 235 235 236 236 this->nodes_.insert(std::pair<CEGUI::Window*, QuestGUINode*>(node->getWindow(),node)); //!< Insert the node and its window in the nodes_ map. 237 237 238 238 index++; 239 239 -
code/branches/presentation2/src/modules/questsystem/QuestGUI.h
r5781 r6387 56 56 57 57 public: 58 58 59 59 QuestGUI(PlayerInfo* player); 60 60 virtual ~QuestGUI(); … … 86 86 inline PlayerInfo* getPlayer(void) 87 87 { return this->player_; } 88 88 89 89 private: 90 90 91 91 int createNode(QuestGUINode* parent, QuestItem* item, int depth, int index); //!< Recursive method to create Nodes for all Quests an Hints the given Quest is a parent to. 92 92 -
code/branches/presentation2/src/modules/questsystem/QuestGUINode.cc
r5781 r6387 119 119 void QuestGUINode::toggleVisibility(void) 120 120 { 121 121 122 122 } 123 123 … … 209 209 offset += height; 210 210 } 211 211 212 212 //! Create title pane for the description. 213 213 stream.str(""); … … 282 282 { 283 283 COUT(3) << "Open QuestItem..." << std::endl; 284 284 285 285 //CEGUI::Window* window = this->gui_->getRootWindow(); 286 286 CEGUI::Window* window = this->gui_->getWindowManager()->getWindow("orxonox/QuestGUI/Background"); … … 344 344 //! Set the height to the window. 345 345 window->setHeight(CEGUI::UDim(0, height)); 346 346 347 347 //Debug 348 348 const CEGUI::Rect newArea = getStaticTextArea(window); … … 368 368 { 369 369 Quest* quest = dynamic_cast<Quest*>(this->item_); 370 370 371 371 this->window_ = this->gui_->getWindow(); 372 372 std::ostringstream stream; … … 377 377 } 378 378 stream << this->index_; 379 379 380 380 this->window_->rename(stream.str()); 381 381 this->window_->setText(this->item_->getDescription()->getTitle()); -
code/branches/presentation2/src/modules/questsystem/QuestGUINode.h
r5781 r6387 44 44 45 45 public: 46 46 47 47 QuestGUINode(void); 48 48 QuestGUINode(QuestGUI* gui, QuestGUINode* parent, QuestItem* item, int depth, int index); 49 49 virtual ~QuestGUINode(void); 50 50 51 51 void toggleVisibility(void); 52 52 -
code/branches/presentation2/src/modules/questsystem/QuestHint.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 71 71 72 72 QuestManager::getInstance().registerHint(this); //!< Registers the QuestHint with the QuestManager. 73 73 74 74 COUT(3) << "New QuestHint {" << this->getId() << "} created." << std::endl; 75 75 } … … 100 100 return it->second; 101 101 } 102 102 103 103 return QuestStatus::Inactive; 104 104 } … … 119 119 { 120 120 this->playerStatus_[player] = QuestHintStatus::Active; 121 121 122 122 this->getDescription()->sendAddHintNotification(); 123 123 return true; … … 129 129 } 130 130 } 131 131 132 132 COUT(2) << "A hint of a non-active quest was trying to get activated." << std::endl; 133 133 return false; -
code/branches/presentation2/src/modules/questsystem/QuestItem.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 86 86 return; 87 87 } 88 88 89 89 this->id_ = id; 90 90 } -
code/branches/presentation2/src/modules/questsystem/QuestListener.cc
r5781 r6387 50 50 { 51 51 RegisterObject(QuestListener); 52 52 53 53 this->mode_ = QuestListenerMode::All; 54 54 this->quest_ = NULL; 55 55 } 56 56 57 57 /** 58 58 @brief … … 62 62 { 63 63 } 64 64 65 65 /** 66 66 @brief … … 75 75 76 76 this->quest_->addListener(this); //!< Adds the QuestListener to the Quests list of listeners. 77 77 78 78 COUT(3) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << std::endl; 79 79 } 80 80 81 81 /** 82 82 @brief … … 98 98 } 99 99 } 100 100 101 101 /** 102 102 @brief … … 110 110 { 111 111 this->quest_ = QuestManager::getInstance().findQuest(id); //!< Find the Quest corresponding to the given questId. 112 112 113 113 if(this->quest_ == NULL) //!< If there is no such Quest. 114 114 { … … 116 116 return false; 117 117 } 118 118 119 119 return true; 120 120 } 121 121 122 122 /** 123 123 @brief … … 152 152 return false; 153 153 } 154 154 155 155 return true; 156 156 } 157 157 158 158 /** 159 159 @brief -
code/branches/presentation2/src/modules/questsystem/QuestNotification.cc
r5781 r6387 38 38 this->initialize(); 39 39 } 40 40 41 41 QuestNotification::QuestNotification(const std::string & message) : Notification(message) 42 42 { 43 43 this->initialize(); 44 44 } 45 45 46 46 QuestNotification::~QuestNotification() 47 47 { 48 48 49 49 } 50 50 -
code/branches/presentation2/src/modules/questsystem/notifications/Notification.cc
r5781 r6387 49 49 this->initialize(); 50 50 } 51 51 52 52 /** 53 53 @brief … … 60 60 this->message_ = message; 61 61 } 62 62 63 63 /** 64 64 @brief … … 68 68 { 69 69 } 70 70 71 71 /** 72 72 @brief … … 79 79 this->sent_ = false; 80 80 } 81 81 82 82 /** 83 83 @brief … … 90 90 return this->send(NotificationManager::NONE); 91 91 } 92 92 93 93 /** 94 94 @brief … … 106 106 return false; 107 107 this->sent_ = true; 108 108 109 109 COUT(3) << "Notification \"" << this->getMessage() << "\" sent." << std::endl; 110 110 111 111 return true; 112 112 } 113 113 114 114 /** 115 115 @brief
Note: See TracChangeset
for help on using the changeset viewer.