#include <src/orxonox/objects/quest/QuestManager.h>
Public Member Functions | |
QuestHint * | findHint (const std::string &hintId) |
Returns the QuestHint with the input id. | |
Quest * | findQuest (const std::string &questId) |
Returns the Quest with the input id. | |
QuestContainer * | getQuestTree (std::string &name) |
QuestManager () | |
Constructor. Registers the object. | |
bool | registerHint (QuestHint *quest) |
Registers a QuestHint in the QuestManager. | |
bool | registerQuest (Quest *quest) |
Registers a Quest in the QuestManager. | |
virtual | ~QuestManager () |
Destructor. | |
Static Public Member Functions | |
static QuestManager & | getInstance () |
Returns a reference to the current (and single) instance of the QuestManager, and creates one if there isn't one to begin with. | |
Private Member Functions | |
HintContainer * | addHints (Quest *quest, const PlayerInfo *player) |
QuestContainer * | addSubQuest (Quest *quest, const PlayerInfo *player) |
void | getRootQuests (const PlayerInfo *player, std::list< Quest * > &list) |
Private Attributes | |
std::map< std::string, QuestHint * > | hintMap_ |
All QuestHints registered by their id's. | |
std::map< std::string, Quest * > | questMap_ |
All Quests registered by their id's. | |
Static Private Attributes | |
static QuestManager * | singletonRef_s = NULL |
Pointer to the current (and single) instance of this class. |
orxonox::QuestManager::QuestManager | ( | ) |
Constructor. Registers the object.
References RegisterRootObject, and singletonRef_s.
orxonox::QuestManager::~QuestManager | ( | ) | [virtual] |
Destructor.
HintContainer * orxonox::QuestManager::addHints | ( | Quest * | quest, | |
const PlayerInfo * | player | |||
) | [private] |
quest | ||
player |
References orxonox::HintContainer::description, orxonox::QuestDescription::getDescription(), orxonox::Quest::getHintsList(), and orxonox::HintContainer::next.
Referenced by addSubQuest().
QuestContainer * orxonox::QuestManager::addSubQuest | ( | Quest * | quest, | |
const PlayerInfo * | player | |||
) | [private] |
quest | ||
player |
References addHints(), COUT, orxonox::QuestContainer::description, orxonox::QuestItem::getDescription(), orxonox::Quest::getSubQuestList(), orxonox::QuestContainer::hint, orxonox::Quest::isActive(), orxonox::Quest::isCompleted(), orxonox::Quest::isFailed(), orxonox::Quest::isInactive(), orxonox::QuestContainer::next, orxonox::QuestContainer::status, and orxonox::QuestContainer::subQuests.
Referenced by getQuestTree().
QuestHint * orxonox::QuestManager::findHint | ( | const std::string & | hintId | ) |
Returns the QuestHint with the input id.
Finds a QuestHint with the given id.
hintId | The id of the QuestHint sought for. |
Throws | an exception if the given hintId is invalid. |
< Check vor validity of the given id.
< If the QuestHint is registered.
References COUT, hintMap_, orxonox::QuestItem::isId(), and ThrowException.
Referenced by orxonox::AddQuestHint::invoke().
Quest * orxonox::QuestManager::findQuest | ( | const std::string & | questId | ) |
Returns the Quest with the input id.
Finds a Quest with the given id.
questId | The id of the Quest sought for. |
Throws | an exception if the given questId is invalid. |
< Check vor validity of the given id.
< If the Quest is registered.
References COUT, orxonox::QuestItem::isId(), questMap_, and ThrowException.
Referenced by orxonox::FailQuest::invoke(), orxonox::CompleteQuest::invoke(), orxonox::AddQuest::invoke(), and orxonox::QuestListener::setQuestId().
QuestManager & orxonox::QuestManager::getInstance | ( | ) | [static] |
Returns a reference to the current (and single) instance of the QuestManager, and creates one if there isn't one to begin with.
References singletonRef_s.
Referenced by orxonox::FailQuest::invoke(), orxonox::CompleteQuest::invoke(), orxonox::AddQuestHint::invoke(), orxonox::AddQuest::invoke(), orxonox::QuestListener::setQuestId(), tolua_Orxonox_orxonox_QuestManager_getInstance00(), orxonox::QuestHint::XMLPort(), and orxonox::Quest::XMLPort().
QuestContainer * orxonox::QuestManager::getQuestTree | ( | std::string & | name | ) |
name |
References addSubQuest(), COUT, orxonox::GUIManager::getInstance(), orxonox::GUIManager::getOverlay(), orxonox::OrxonoxOverlay::getOwner(), getRootQuests(), and orxonox::QuestContainer::next.
void orxonox::QuestManager::getRootQuests | ( | const PlayerInfo * | player, | |
std::list< Quest * > & | list | |||
) | [private] |
player | ||
list |
References orxonox::Quest::getParentQuest(), orxonox::Quest::isInactive(), and questMap_.
Referenced by getQuestTree().
bool orxonox::QuestManager::registerHint | ( | QuestHint * | hint | ) |
Registers a QuestHint in the QuestManager.
Registers a QuestHint with the QuestManager to make it globally accessable. Uses it's id to make sure to be able to be identify and retrieve it later.
hint | The QuestHint to be registered. |
< Still not liking NULL-pointers.
< Inserting the QuestHSint.
< If inserting was a success.
References COUT, orxonox::QuestItem::getId(), and hintMap_.
Referenced by orxonox::QuestHint::XMLPort().
bool orxonox::QuestManager::registerQuest | ( | Quest * | quest | ) |
Registers a Quest in the QuestManager.
Registers a Quest with the QuestManager to make it globally accessable. Uses it's id to make sure to be able to be identify and retrieve it later.
quest | The Quest that is to be registered. |
< Doh! Just as if there were actual quests behind NULL-pointers.
< Inserting the Quest.
< If inserting was a success.
References COUT, orxonox::QuestItem::getId(), and questMap_.
Referenced by orxonox::Quest::XMLPort().
std::map<std::string, QuestHint*> orxonox::QuestManager::hintMap_ [private] |
std::map<std::string, Quest*> orxonox::QuestManager::questMap_ [private] |
All Quests registered by their id's.
Referenced by findQuest(), getRootQuests(), and registerQuest().
QuestManager * orxonox::QuestManager::singletonRef_s = NULL [static, private] |
Pointer to the current (and single) instance of this class.
Referenced by getInstance(), and QuestManager().