Orxonox: orxonox::QuestManager Class Reference

# 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:

List of all members.

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

## 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]`

Parameters:

  | quest |
  | player |

Returns:

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]`

Parameters:

  | quest |
  | player |

Returns:

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.

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

Parameters:

  | name |

Returns:

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]`

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

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

All QuestHints registered by their id's.

Referenced by findHint(), and registerHint().

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

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

- src/orxonox/objects/quest/QuestManager.h
- src/orxonox/objects/quest/QuestManager.cc