orxonox::QuestManager Class Reference

Is a Singleton and manages Quests, by registering every Quest/QuestHint (through registerX()) and making them globally accessable (through findX()). Quests (and QuestHints) are registered in the QuestManager with their id, and can be accessed in the same way. More...

#include <src/orxonox/objects/quest/QuestManager.h>

Inheritance diagram for orxonox::QuestManager:

orxonox::OrxonoxClass

List of all members.

Public Member Functions

QuestHintfindHint (const std::string &hintId)
 Returns the QuestHint with the input id.
QuestfindQuest (const std::string &questId)
 Returns the Quest with the input id.
QuestContainergetQuestTree (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 QuestManagergetInstance ()
 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

HintContaineraddHints (Quest *quest, const PlayerInfo *player)
QuestContaineraddSubQuest (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 QuestManagersingletonRef_s = NULL
 Pointer to the current (and single) instance of this class.


Detailed Description

Is a Singleton and manages Quests, by registering every Quest/QuestHint (through registerX()) and making them globally accessable (through findX()). Quests (and QuestHints) are registered in the QuestManager with their id, and can be accessed in the same way.

Author:
Damian 'Mozork' Frick

Constructor & Destructor Documentation

orxonox::QuestManager::QuestManager (  ) 

Constructor. Registers the object.

Todo:
Is inheriting from BaseObject proper?

References RegisterRootObject, and singletonRef_s.

orxonox::QuestManager::~QuestManager (  )  [virtual]

Destructor.


Member Function Documentation

HintContainer * orxonox::QuestManager::addHints ( Quest quest,
const PlayerInfo player 
) [private]

QuestContainer * orxonox::QuestManager::addSubQuest ( Quest quest,
const PlayerInfo player 
) [private]

QuestHint * orxonox::QuestManager::findHint ( const std::string hintId  ) 

Returns the QuestHint with the input id.

Finds a QuestHint with the given id.

Parameters:
hintId The id of the QuestHint sought for.
Returns:
Returns a pointer to the QuestHint with the input id. Returns NULL if there is no QuestHint with the given hintId.
Exceptions:
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.

Parameters:
questId The id of the Quest sought for.
Returns:
Returns a pointer to the Quest with the input id. Returns NULL if there is no Quest with the given questId.
Exceptions:
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.

Returns:
Returns a reference to the single instance of the Quest Manager.

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  ) 

void orxonox::QuestManager::getRootQuests ( const PlayerInfo player,
std::list< Quest * > &  list 
) [private]

Parameters:
player 
list 
Returns:

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.

Parameters:
hint The QuestHint to be registered.
Returns:
Returns true if successful, false if not.

< 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.

Parameters:
quest The Quest that is to be registered.
Returns:
Returns true if successful, false if not.

< 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().


Member Data Documentation

All QuestHints registered by their id's.

Referenced by findHint(), and registerHint().

All Quests registered by their id's.

Referenced by findQuest(), getRootQuests(), and registerQuest().

Pointer to the current (and single) instance of this class.

Referenced by getInstance(), and QuestManager().


The documentation for this class was generated from the following files:

Generated on Tue Jul 28 16:22:59 2009 for Orxonox by  doxygen 1.5.6