Changeset 7072 for code/branches/presentation3/src/modules
- Timestamp:
- Jun 1, 2010, 9:28:28 PM (15 years ago)
- Location:
- code/branches/presentation3/src/modules/questsystem
- Files:
-
- 4 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/modules/questsystem/CMakeLists.txt
r6800 r7072 12 12 QuestEffect.cc 13 13 QuestEffectBeacon.cc 14 QuestGUINode.cc15 QuestGUI.cc16 14 QuestHint.cc 17 15 QuestItem.cc … … 28 26 TOLUA_FILES 29 27 QuestManager.h 28 QuestDescription.h 29 Quest.h 30 QuestHint.h 30 31 DEFINE_SYMBOL 31 32 "QUESTSYSTEM_SHARED_BUILD" -
code/branches/presentation3/src/modules/questsystem/Quest.h
r6940 r7072 41 41 #include "QuestItem.h" 42 42 43 namespace orxonox 44 { 43 namespace orxonox // tolua_export 44 { // tolua_export 45 45 namespace QuestStatus 46 46 { … … 67 67 Damian 'Mozork' Frick 68 68 */ 69 class _QuestsystemExport Quest : public QuestItem 70 { 69 class _QuestsystemExport Quest // tolua_export 70 : public QuestItem 71 { // tolua_export 71 72 public: 72 73 Quest(BaseObject* creator); … … 97 98 98 99 bool isInactive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'inactive'. 99 bool isActive(const PlayerInfo* player) const;//!< Returns true if the quest status for the specific player is 'active'.100 bool isFailed(const PlayerInfo* player) const;//!< Returns true if the quest status for the specific player is 'failed'.101 bool isCompleted(const PlayerInfo* player) const;//!< Returns true if the quest status for the specific player is 'completed'.100 bool isActive(const orxonox::PlayerInfo* player) const; // tolua_export //!< Returns true if the quest status for the specific player is 'active'. 101 bool isFailed(const orxonox::PlayerInfo* player) const; // tolua_export //!< Returns true if the quest status for the specific player is 'failed'. 102 bool isCompleted(const orxonox::PlayerInfo* player) const; // tolua_export //!< Returns true if the quest status for the specific player is 'completed'. 102 103 103 104 bool start(PlayerInfo* player); //!< Sets a Quest to active. … … 151 152 bool addCompleteEffect(QuestEffect* effect); //!< Adds an QuestEffect to the list of complete QuestEffects. 152 153 153 }; 154 }; // tolua_export 154 155 155 } 156 } // tolua_export 156 157 157 158 #endif /* _Quest_H__ */ -
code/branches/presentation3/src/modules/questsystem/QuestHint.h
r5781 r7072 40 40 #include "QuestItem.h" 41 41 42 namespace orxonox 43 { 42 namespace orxonox // tolua_export 43 { // tolua_export 44 44 namespace QuestHintStatus 45 45 { … … 66 66 Damian 'Mozork' Frick 67 67 */ 68 class _QuestsystemExport QuestHint : public QuestItem 69 { 68 class _QuestsystemExport QuestHint // tolua_export 69 : public QuestItem 70 { // tolua_export 70 71 71 72 public: … … 91 92 std::map<const PlayerInfo*, QuestHintStatus::Value> playerStatus_; //!< List of the states for each player, with the Player-pointer as key. 92 93 93 }; 94 }; // tolua_export 94 95 95 } 96 } // tolua_export 96 97 97 98 #endif /* _QuestHint_H__ */ -
code/branches/presentation3/src/modules/questsystem/QuestManager.cc
r6945 r7072 74 74 QuestManager::~QuestManager() 75 75 { 76 for(std::map<PlayerInfo*, QuestGUI*>::iterator it = this->questGUIs_.begin(); it != this->questGUIs_.end(); it++) 77 { 78 it->second->destroy(); 79 } 80 this->questGUIs_.clear(); 76 81 77 } 82 78 … … 244 240 } 245 241 246 /** 247 @brief 248 Retreive the main window for the GUI. 249 This is for the use in the lua script tu start the QuestGUI. 250 @param guiName 251 The name of the GUI. 252 @return 253 Returns a CEGUI Window. 254 */ 255 CEGUI::Window* QuestManager::getQuestGUI(const std::string & guiName) 256 { 257 PlayerInfo* player = this->retrievePlayer(guiName); 258 259 if(this->questGUIs_.find(player) == this->questGUIs_.end()) //!< Create a new GUI, if there is none, yet. 260 this->questGUIs_[player] = new QuestGUI(player); 261 262 return this->questGUIs_[player]->getGUI(); 242 int QuestManager::getNumParentQuests(PlayerInfo* player) 243 { 244 int numQuests = 0; 245 for(std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++) 246 { 247 if(it->second->getParentQuest() == NULL && !it->second->isInactive(player)) 248 numQuests++; 249 } 250 return numQuests; 251 } 252 253 Quest* QuestManager::getParentQuest(PlayerInfo* player, int index) 254 { 255 for(std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++) 256 { 257 if(it->second->getParentQuest() == NULL && !it->second->isInactive(player) && index-- == 0) 258 return it->second; 259 } 260 return NULL; 261 } 262 263 int QuestManager::getNumSubQuests(Quest* quest, PlayerInfo* player) 264 { 265 std::list<Quest*> quests = quest->getSubQuestList(); 266 int numQuests = 0; 267 for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++) 268 { 269 if(!(*it)->isInactive(player)) 270 numQuests++; 271 } 272 return numQuests; 273 } 274 275 Quest* QuestManager::getSubQuest(Quest* quest, PlayerInfo* player, int index) 276 { 277 std::list<Quest*> quests = quest->getSubQuestList(); 278 for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++) 279 { 280 if(!(*it)->isInactive(player) && index-- == 0) 281 return *it; 282 } 283 return NULL; 284 } 285 286 int QuestManager::getNumHints(Quest* quest, PlayerInfo* player) 287 { 288 std::list<QuestHint*> hints = quest->getHintsList(); 289 int numHints = 0; 290 for(std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++) 291 { 292 if((*it)->isActive(player)) 293 numHints++; 294 } 295 return numHints; 296 } 297 298 QuestHint* QuestManager::getHints(Quest* quest, PlayerInfo* player, int index) 299 { 300 std::list<QuestHint*> hints = quest->getHintsList(); 301 for(std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++) 302 { 303 if((*it)->isActive(player) && index-- == 0) 304 return *it; 305 } 306 return NULL; 307 } 308 309 QuestDescription* QuestManager::getDescription(Quest* item) 310 { 311 return item->getDescription(); 312 } 313 314 QuestDescription* QuestManager::getDescription(QuestHint* item) 315 { 316 return item->getDescription(); 263 317 } 264 318 -
code/branches/presentation3/src/modules/questsystem/QuestManager.h
r6940 r7072 36 36 37 37 #include "questsystem/QuestsystemPrereqs.h" 38 #include <CEGUIForwardRefs.h>39 38 40 39 #include <list> … … 44 43 #include "util/Singleton.h" 45 44 #include "core/OrxonoxClass.h" 46 47 #include "QuestGUI.h"48 45 49 46 // tolua_begin … … 63 60 64 61 friend class Singleton<QuestManager>; 65 friend class QuestGUI;66 62 67 63 public: … … 72 68 static QuestManager& getInstance() { return Singleton<QuestManager>::getInstance(); } // tolua_export 73 69 74 //! Retrieve the main window for the GUI. 75 CEGUI::Window* getQuestGUI(const std::string & guiName); // tolua_export 70 // tolua_begin 71 int getNumParentQuests(orxonox::PlayerInfo* player); 72 Quest* getParentQuest(orxonox::PlayerInfo* player, int index); 73 74 int getNumSubQuests(Quest* quest, orxonox::PlayerInfo* player); 75 Quest* getSubQuest(Quest* quest, orxonox::PlayerInfo* player, int index); 76 77 int getNumHints(Quest* quest, orxonox::PlayerInfo* player); 78 QuestHint* getHints(Quest* quest, orxonox::PlayerInfo* player, int index); 79 80 QuestDescription* getDescription(Quest* item); 81 QuestDescription* getDescription(QuestHint* item); 82 // tolua_end 76 83 77 84 bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager. … … 93 100 std::map<std::string, QuestHint*> hintMap_; //!< All QuestHints registered by their id's. 94 101 95 std::map<PlayerInfo*, QuestGUI*> questGUIs_; //!< All GUI's registered by the players.96 97 102 }; // tolua_export 98 103 -
code/branches/presentation3/src/modules/questsystem/QuestsystemPrereqs.h
r5929 r7072 77 77 class QuestEffect; 78 78 class QuestEffectBeacon; 79 class QuestGUI;80 class QuestGUINode;81 79 class QuestHint; 82 80 class QuestItem;
Note: See TracChangeset
for help on using the changeset viewer.