Orxonox: orxonox::QuestHint Class Reference

# orxonox::QuestHint Class Reference

Represents a hint in the game towards completing a Quest. Consists of title and description (which is stored in a QuestDescription object) in textual form and must belong to a quest. A QuestHint has a defined status (inactive or active, where inactive is default) for each player, which means each a QuestHint exists only once for all players, it doesn't belong to a player, it just has different states for each of them. More...

`#include <src/orxonox/objects/quest/QuestHint.h>`

Inheritance diagram for orxonox::QuestHint:

List of all members.

## Public Member Functions

Quest * | getQuest (void)
| Returns the Quest the QuestHint is attached to.
bool | isActive (const PlayerInfo *player) const
| Returns true if the QuestHint is active for the input player.
| QuestHint (BaseObject *creator)
| Constructor. Registers the object.
bool | setActive (PlayerInfo *player)
| Activates the QuestHint for the input player.
bool | setQuest (Quest *quest)
| Sets the Quest the QuestHint belongs to.
virtual void | XMLPort (Element &xmlelement, XMLPort::Mode mode)
| Method for creating a QuestHint object through XML.
virtual | ~QuestHint ()
| Destructor.

## Private Attributes

std::map< const PlayerInfo *, QuestHintStatus::Value > | playerStatus_
| List of the states for each player, with the Player-pointer as key.
Quest * | quest_
| The Quest the QuestHint belongs to.

## Detailed Description

Represents a hint in the game towards completing a Quest. Consists of title and description (which is stored in a QuestDescription object) in textual form and must belong to a quest. A QuestHint has a defined status (inactive or active, where inactive is default) for each player, which means each a QuestHint exists only once for all players, it doesn't belong to a player, it just has different states for each of them.

Creating a QuestHint through XML goes as follows:

<QuestHint id="hintId"> //Where hintId is a GUID, see http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure for more information <QuestDesctription title="" description=""> </QuestHint>

Author:
  Damian 'Mozork' Frick

## Constructor & Destructor Documentation

orxonox::QuestHint::QuestHint | ( | BaseObject * | creator | ) |

Constructor. Registers the object.

References RegisterObject.

orxonox::QuestHint::~QuestHint | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

Quest* orxonox::QuestHint::getQuest | ( | void |  | ) | `[inline]`

Returns the Quest the QuestHint is attached to.

Returns:
  Returns a pointer to the Quest the QuestHint is attached to.

bool orxonox::QuestHint::isActive | ( | const PlayerInfo * | player | ) | const

Returns true if the QuestHint is active for the input player.

Checks whether the QuestHint is active for a specific player.

Parameters:

  | player | The player.

Exceptions:

  | Throws | an Argument Exception if the input Player-pointer is NULL.

Returns:
  Returns true if the QuestHint is active for the specified player.

< NULL-Pointers are ugly!

Find the player.

< If the player is in the map.

References orxonox::QuestStatus::Inactive, playerStatus_, and ThrowException.

bool orxonox::QuestHint::setActive | ( | PlayerInfo * | player | ) |

Activates the QuestHint for the input player.

Activates a QuestHint for a given player.

Parameters:

  | player | The player.

Returns:
  Returns true if the activation was successful, false if there were problems.

< For a hint to get activated the quest must be active.

< If the hint is already active, activation is pointless.

References orxonox::QuestHintStatus::Active, COUT, orxonox::QuestItem::getDescription(), orxonox::BaseObject::isActive(), orxonox::Quest::isActive(), playerStatus_, quest_, and orxonox::QuestDescription::sendAddHintNotification().

Referenced by orxonox::AddQuestHint::invoke().

bool orxonox::QuestHint::setQuest | ( | Quest * | quest | ) |

Sets the Quest the QuestHint belongs to.

Parameters:

  | quest | The Quest to be set as Quest the QuestHint is attached to.

Returns:
  Returns true if successful.

< NULL-Pointer. Again..?

References COUT, and quest_.

Referenced by orxonox::Quest::addHint().

void orxonox::QuestHint::XMLPort | ( | Element & | xmlelement,
|  | XMLPort::Mode | mode |
| ) |  |  | `[virtual]`

Method for creating a QuestHint object through XML.

< Registers the QuestHint with the QuestManager.

Reimplemented from orxonox::QuestItem.

References COUT, orxonox::QuestItem::getId(), orxonox::QuestManager::getInstance(), orxonox::QuestManager::registerHint(), and SUPER.

## Member Data Documentation

std::map<const PlayerInfo*, QuestHintStatus::Value> orxonox::QuestHint::playerStatus_`[private]`

List of the states for each player, with the Player-pointer as key.

Referenced by isActive(), and setActive().

Quest* orxonox::QuestHint::quest_`[private]`

The Quest the QuestHint belongs to.

Referenced by setActive(), and setQuest().

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

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