Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
orxonox::QuestManager Class Reference

Is a Singleton and manages Quests, by registering every Quest / QuestHint (through registerX()) and making them globally accessible (through findX()). More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/modules/questsystem/QuestManager.h>

Inheritance diagram for orxonox::QuestManager:
orxonox::Singleton< QuestManager >

Public Member Functions

 QuestManager ()
 Constructor. More...
 
virtual ~QuestManager ()
 Destructor. More...
 
QuestHintfindHint (const std::string &hintId)
 Returns the QuestHint with the input id. More...
 
QuestfindQuest (const std::string &questId)
 Returns the Quest with the input id. More...
 
QuestDescriptiongetDescription (Quest *item)
 Get the QuestDescription of the input Quest. More...
 
QuestDescriptiongetDescription (QuestHint *item)
 Get the QuestDescription of the input QuestHint. More...
 
QuestHintgetHints (Quest *quest, orxonox::PlayerInfo *player, int index)
 Get the index-th QuestHint of the input Quest for the input player. More...
 
const std::string getId (Quest *item) const
 Get the id of the input Quest. More...
 
const std::string getId (QuestHint *item) const
 Get the id of the input QuestHint. More...
 
int getNumHints (Quest *quest, orxonox::PlayerInfo *player)
 Get the number of QuestHints of the input Quest for the input player. More...
 
int getNumRootQuests (orxonox::PlayerInfo *player)
 Get the number of Quests the input player has, that are root quests. More...
 
int getNumSubQuests (Quest *quest, orxonox::PlayerInfo *player)
 Get the number of sub-quest of an input Quest for an input player. More...
 
QuestgetParentQuest (Quest *quest)
 Get the parent-quest of the input Quest. More...
 
QuestgetRootQuest (orxonox::PlayerInfo *player, int index)
 Get the index-th root quest of the input player. More...
 
QuestgetSubQuest (Quest *quest, orxonox::PlayerInfo *player, int index)
 Get the index-th sub-quest of the input Quest for the input player. More...
 
bool registerHint (QuestHint *hint)
 Registers a QuestHint in the QuestManager. More...
 
bool registerQuest (Quest *quest)
 Registers a Quest in the QuestManager. More...
 
bool unregisterHint (QuestHint *hint)
 Unregisters a QuestHint in the QuestManager. More...
 
bool unregisterQuest (Quest *quest)
 Unregisters a Quest in the QuestManager. More...
 

Static Public Member Functions

static QuestManagergetInstance ()
 Returns a reference to the single instance of the QuestManager. More...
 
- Static Public Member Functions inherited from orxonox::Singleton< QuestManager >
static bool exists ()
 Tells whether the singleton has been created. More...
 
static QuestManagergetInstance ()
 Returns a reference to the singleton instance. More...
 

Protected Member Functions

std::map< std::string, Quest * > & getQuests (void)
 Retrieve all Quests. More...
 
- Protected Member Functions inherited from orxonox::Singleton< QuestManager >
 Singleton ()
 Constructor sets the singleton instance pointer. More...
 
virtual ~Singleton ()
 Destructor resets the singleton instance pointer. More...
 

Private Member Functions

PlayerInforetrievePlayer (const std::string &guiName)
 Retrieve the player for a certain GUI. More...
 

Private Attributes

std::map< std::string, QuestHint * > hintMap_
 All QuestHints registered by their id's. More...
 
std::map< std::string, Quest * > questMap_
 All Quests registered by their id's. More...
 

Static Private Attributes

static QuestManagersingletonPtr_s
 

Friends

class Singleton< QuestManager >
 

Detailed Description

Is a Singleton and manages Quests, by registering every Quest / QuestHint (through registerX()) and making them globally accessible (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?
orxonox::QuestManager::~QuestManager ( )
virtual

Destructor.

Member Function Documentation

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

Returns the QuestHint with the input id.

Finds a QuestHint with the given id.

Parameters
hintIdThe id of the QuestHint sought for.
Returns
Returns a pointer to the QuestHint with the input id. Returns nullptr if there is no QuestHint with the given hintId.
Exceptions
Throwsan exception if the given hintId is invalid.
Quest * orxonox::QuestManager::findQuest ( const std::string &  questId)

Returns the Quest with the input id.

Finds a Quest with the given id.

Parameters
questIdThe id of the Quest sought for.
Returns
Returns a pointer to the Quest with the input id. Returns nullptr if there is no Quest with the given questId.
Exceptions
Throwsan exception if the given questId is invalid.
QuestDescription * orxonox::QuestManager::getDescription ( Quest item)

Get the QuestDescription of the input Quest.

Parameters
itemThe Quest to get the QuestDescription of.
Returns
Return a pointer ot the QuestDescription of the input Quest.
QuestDescription * orxonox::QuestManager::getDescription ( QuestHint item)

Get the QuestDescription of the input QuestHint.

Parameters
itemThe QuestHint to get the QuestDescription of.
Returns
Returns a pointer to the QuestDescription of the input QuestHint.
QuestHint * orxonox::QuestManager::getHints ( Quest quest,
orxonox::PlayerInfo player,
int  index 
)

Get the index-th QuestHint of the input Quest for the input player.

Parameters
questThe Quest to get the QuestHint of.
playerThe player.
indexThe index of the QuestHint.
Returns
Returns a pointer to the index-th QuestHint of the input Quest for the input player.
const std::string orxonox::QuestManager::getId ( Quest item) const

Get the id of the input Quest.

Parameters
itemThe Quest to get the id of.
Returns
Returns the id of the input Quest.
const std::string orxonox::QuestManager::getId ( QuestHint item) const

Get the id of the input QuestHint.

Parameters
itemThe QuestHint to get the id of.
Returns
Returns the id of the input QuestHint.
static QuestManager& orxonox::QuestManager::getInstance ( )
inlinestatic

Returns a reference to the single instance of the QuestManager.

int orxonox::QuestManager::getNumHints ( Quest quest,
orxonox::PlayerInfo player 
)

Get the number of QuestHints of the input Quest for the input player.

Parameters
questThe quest to get the hints of.
playerThe player.
Returns
Returns the number of QuestHints of the input Quest for the input player.
int orxonox::QuestManager::getNumRootQuests ( orxonox::PlayerInfo player)

Get the number of Quests the input player has, that are root quests.

Parameters
playerThe player.
Returns
Returns the number of Quests the input player has, that are root quests.
int orxonox::QuestManager::getNumSubQuests ( Quest quest,
orxonox::PlayerInfo player 
)

Get the number of sub-quest of an input Quest for an input player.

Get the number of sub-quest of an input Quest for the input player.

Parameters
questThe quest to get the sub-quests of.
playerThe player.
Returns
Returns the number of sub-quest of an input Quest for the input player.
Quest * orxonox::QuestManager::getParentQuest ( Quest quest)

Get the parent-quest of the input Quest.

Parameters
questThe Quest to get the parent-quest of.
Returns
Returns a pointer to the parent-quest of the input Quest.
std::map< std::string, Quest * > & orxonox::QuestManager::getQuests ( void  )
protected

Retrieve all Quests.

Retreive all Quests.

Returns
Returns a map with all Quests indexed by their id's.
Quest * orxonox::QuestManager::getRootQuest ( orxonox::PlayerInfo player,
int  index 
)

Get the index-th root quest of the input player.

Parameters
playerThe player.
indexThe index of the root quest.
Returns
Returns the index-th root quest of the input player.
Quest * orxonox::QuestManager::getSubQuest ( Quest quest,
orxonox::PlayerInfo player,
int  index 
)

Get the index-th sub-quest of the input Quest for the input player.

Parameters
questThe Quest to get the sub-quest of.
playerThe player.
indexThe index of the sub-quest.
bool orxonox::QuestManager::registerHint ( QuestHint hint)

Registers a QuestHint in the QuestManager.

Registers a QuestHint with the QuestManager to make it globally accessible.

Uses it's id to make sure to be able to be identify and retrieve it later.

Parameters
hintThe QuestHint to be registered.
Returns
Returns true if successful, false if not.
bool orxonox::QuestManager::registerQuest ( Quest quest)

Registers a Quest in the QuestManager.

Registers a Quest with the QuestManager to make it globally accessible.

Uses it's id to make sure to be able to be identify and retrieve it later.

Parameters
questThe Quest that is to be registered.
Returns
Returns true if successful, false if not.
PlayerInfo * orxonox::QuestManager::retrievePlayer ( const std::string &  guiName)
private

Retrieve the player for a certain GUI.

Parameters
guiNameThe name of the GUI the player is retrieved for.
Returns
Returns the player.
Todo:
This very well might be outdated. So: Check if still needed, and update if necessary.
bool orxonox::QuestManager::unregisterHint ( QuestHint hint)

Unregisters a QuestHint in the QuestManager.

bool orxonox::QuestManager::unregisterQuest ( Quest quest)

Unregisters a Quest in the QuestManager.

Friends And Related Function Documentation

friend class Singleton< QuestManager >
friend

Member Data Documentation

std::map<std::string, QuestHint*> orxonox::QuestManager::hintMap_
private

All QuestHints registered by their id's.

std::map<std::string, Quest*> orxonox::QuestManager::questMap_
private

All Quests registered by their id's.

QuestManager* orxonox::QuestManager::singletonPtr_s
staticprivate

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