#include <src/orxonox/objects/quest/Quest.h>
Public Member Functions | |
bool | addListener (QuestListener *listener) |
Adds a QuestListener to the list of QuestListeners listening to this Quest. | |
virtual bool | complete (PlayerInfo *player) |
Completes the Quest. | |
virtual bool | fail (PlayerInfo *player) |
Fails the Quest. | |
const std::list< QuestHint * > & | getHintsList (void) const |
Returns the list of all QuestHints of this Quest. | |
Quest * | getParentQuest (void) const |
Returns the parentquest of the Quest. | |
const std::list< Quest * > & | getSubQuestList (void) const |
Returns the list of subquests. | |
bool | isActive (const PlayerInfo *player) const |
Returns true if the quest status for the specific player is 'active'. | |
bool | isCompleted (const PlayerInfo *player) const |
Returns true if the quest status for the specific player is 'completed'. | |
bool | isFailed (const PlayerInfo *player) const |
Returns true if the quest status for the specific player is 'failed'. | |
bool | isInactive (const PlayerInfo *player) const |
Returns true if the quest status for the specific player is 'inactive'. | |
Quest (BaseObject *creator) | |
Constructor. Registers and initializes object. | |
bool | start (PlayerInfo *player) |
Sets a Quest to active. | |
virtual void | XMLPort (Element &xmlelement, XMLPort::Mode mode) |
Method for creating a Quest object through XML. | |
virtual | ~Quest () |
Destructor. | |
Protected Member Functions | |
const QuestEffect * | getCompleteEffect (unsigned int index) const |
Returns the complete QuestEffect at the given index. | |
std::list< QuestEffect * > & | getCompleteEffectList (void) |
Returns the list of complete QuestEffects. | |
const QuestEffect * | getFailEffect (unsigned int index) const |
Returns the fail QuestEffect at the given index. | |
std::list< QuestEffect * > & | getFailEffectList (void) |
Returns the list of fail QuestEffects. | |
const QuestHint * | getHint (unsigned int index) const |
Returns the QuestHint at the given index. | |
virtual QuestStatus::Value | getStatus (const PlayerInfo *player) const =0 |
Returns the status of the Quest for a specific player. | |
const Quest * | getSubQuest (unsigned int index) const |
Returns the subquest at the given index. | |
virtual bool | isCompletable (const PlayerInfo *player) const =0 |
Checks whether the Quest can be completed. | |
virtual bool | isFailable (const PlayerInfo *player) const =0 |
Checks whether the Quest can be failed. | |
virtual bool | isStartable (const PlayerInfo *player) const =0 |
Checks whether the Quest can be started. | |
virtual bool | setStatus (PlayerInfo *player, const QuestStatus::Value &status)=0 |
Changes the status for a specific player. | |
Private Member Functions | |
bool | addCompleteEffect (QuestEffect *effect) |
Adds an QuestEffect to the list of complete QuestEffects. | |
bool | addFailEffect (QuestEffect *effect) |
Adds an QuestEffect to the list of fail QuestEffects. | |
bool | addHint (QuestHint *hint) |
Add a QuestHint to the list of QuestHints. | |
bool | addSubQuest (Quest *quest) |
Adds a subquest to the Quest. | |
bool | setParentQuest (Quest *quest) |
Sets the parentquest of the Quest. | |
Private Attributes | |
std::list< QuestEffect * > | completeEffects_ |
A list of QuestEffects to be invoked, when the Quest has been completed. | |
std::list< QuestEffect * > | failEffects_ |
A list of all QuestEffects to be invoked, when the Quest has been failed. | |
std::list< QuestHint * > | hints_ |
A list of all the QuestHints tied to this Quest. | |
std::list< QuestListener * > | listeners_ |
A list of QuestListeners, that listen to what exactly happens with this Quest. | |
Quest * | parentQuest_ |
Pointer to the parentquest. | |
std::list< Quest * > | subQuests_ |
List of all the subquests. |
Quest itself should not be instantiated, if you want to create a quest either go for LocalQuest or GlobalQuest, whichever suits you needs better.
orxonox::Quest::Quest | ( | BaseObject * | creator | ) |
orxonox::Quest::~Quest | ( | ) | [virtual] |
Destructor.
bool orxonox::Quest::addCompleteEffect | ( | QuestEffect * | effect | ) | [private] |
Adds an QuestEffect to the list of complete QuestEffects.
effect | The QuestEffect to be added. |
< We don't want to set NULL-Pointers.
< Adds the QuestEffect to the end of the list of complete QuestEffects.
References completeEffects_, COUT, and orxonox::QuestItem::getId().
Referenced by XMLPort().
bool orxonox::Quest::addFailEffect | ( | QuestEffect * | effect | ) | [private] |
Adds an QuestEffect to the list of fail QuestEffects.
effect | The QuestEffect to be added. |
< We don't want to set NULL-Pointers.
< Adds the QuestEffect to the end of the list of fail QuestEffects.
References COUT, failEffects_, and orxonox::QuestItem::getId().
Referenced by XMLPort().
bool orxonox::Quest::addHint | ( | QuestHint * | hint | ) | [private] |
Add a QuestHint to the list of QuestHints.
Adds a QuestHint to the list of QuestHints.
hint | The QuestHint that should be added to the list of QuestHints. |
< We don't want to set NULL-Pointers. Seriously!
< Sets the current Quest (this) as Quest for the added QuestHint.
< Adds the QuestHint to the end of the list of QuestHints.
References COUT, orxonox::QuestItem::getId(), hints_, and orxonox::QuestHint::setQuest().
Referenced by XMLPort().
bool orxonox::Quest::addListener | ( | QuestListener * | listener | ) |
Adds a QuestListener to the list of QuestListeners listening to this Quest.
listener | The QuestListener to be added. |
References COUT, and listeners_.
Referenced by orxonox::QuestListener::XMLPort().
bool orxonox::Quest::addSubQuest | ( | Quest * | quest | ) | [private] |
Adds a subquest to the Quest.
quest | A pointer to the Quest to be set as subquest. |
< We don't want to set NULL-Pointers.
< Sets the currentQuest (this) as parentquest for the added subquest.
< Adds the Quest to the end of the list of subquests.
References COUT, orxonox::QuestItem::getId(), setParentQuest(), and subQuests_.
Referenced by XMLPort().
bool orxonox::Quest::complete | ( | PlayerInfo * | player | ) | [virtual] |
Completes the Quest.
Completes the Quest for an input player.
player | The player. |
< Tells the QuestListeners, that the status has changed to completed.
Reimplemented in orxonox::GlobalQuest, and orxonox::LocalQuest.
References orxonox::QuestListener::advertiseStatusChange(), orxonox::QuestStatus::Completed, COUT, orxonox::QuestItem::getDescription(), orxonox::QuestItem::getId(), listeners_, orxonox::QuestDescription::sendCompleteQuestNotification(), and setStatus().
Referenced by orxonox::LocalQuest::complete(), orxonox::GlobalQuest::complete(), and orxonox::CompleteQuest::invoke().
bool orxonox::Quest::fail | ( | PlayerInfo * | player | ) | [virtual] |
Fails the Quest.
Fails the Quest for an input player.
player | The player. |
< Tells the QuestListeners, that the status has changed to failed.
Reimplemented in orxonox::GlobalQuest, and orxonox::LocalQuest.
References orxonox::QuestListener::advertiseStatusChange(), COUT, orxonox::QuestStatus::Failed, orxonox::QuestItem::getDescription(), orxonox::QuestItem::getId(), listeners_, orxonox::QuestDescription::sendFailQuestNotification(), and setStatus().
Referenced by orxonox::LocalQuest::fail(), orxonox::GlobalQuest::fail(), and orxonox::FailQuest::invoke().
const QuestEffect * orxonox::Quest::getCompleteEffect | ( | unsigned int | index | ) | const [protected] |
Returns the complete QuestEffect at the given index.
The | index. |
Iterate through all complete QuestEffects.
< We're counting down...
< If the index is greater than the number of elements in the list.
References completeEffects_.
Referenced by XMLPort().
std::list<QuestEffect*>& orxonox::Quest::getCompleteEffectList | ( | void | ) | [inline, protected] |
Returns the list of complete QuestEffects.
Referenced by orxonox::LocalQuest::complete(), and orxonox::GlobalQuest::complete().
const QuestEffect * orxonox::Quest::getFailEffect | ( | unsigned int | index | ) | const [protected] |
Returns the fail QuestEffect at the given index.
The | index. |
Iterate through all fail QuestEffects.
< We're counting down...
< If the index is greater than the number of elements in the list.
References failEffects_.
Referenced by XMLPort().
std::list<QuestEffect*>& orxonox::Quest::getFailEffectList | ( | void | ) | [inline, protected] |
Returns the list of fail QuestEffects.
Referenced by orxonox::LocalQuest::fail(), and orxonox::GlobalQuest::fail().
const QuestHint * orxonox::Quest::getHint | ( | unsigned int | index | ) | const [protected] |
Returns the QuestHint at the given index.
The | index. |
Iterate through all QuestHints.
< We're counting down...
< If the index is greater than the number of elements in the list.
References hints_.
Referenced by XMLPort().
const std::list<QuestHint*>& orxonox::Quest::getHintsList | ( | void | ) | const [inline] |
Returns the list of all QuestHints of this Quest.
Referenced by orxonox::QuestManager::addHints().
Quest* orxonox::Quest::getParentQuest | ( | void | ) | const [inline] |
Returns the parentquest of the Quest.
Referenced by orxonox::QuestManager::getRootQuests(), orxonox::LocalQuest::isStartable(), and orxonox::GlobalQuest::isStartable().
virtual QuestStatus::Value orxonox::Quest::getStatus | ( | const PlayerInfo * | player | ) | const [protected, pure virtual] |
Returns the status of the Quest for a specific player.
Implemented in orxonox::GlobalQuest, and orxonox::LocalQuest.
Referenced by isActive(), isCompleted(), isFailed(), and isInactive().
const Quest * orxonox::Quest::getSubQuest | ( | unsigned int | index | ) | const [protected] |
Returns the subquest at the given index.
The | index. |
Iterate through all subquests.
< We're counting down...
< If the index is greater than the number of elements in the list.
References subQuests_.
Referenced by XMLPort().
const std::list<Quest*>& orxonox::Quest::getSubQuestList | ( | void | ) | const [inline] |
Returns the list of subquests.
Referenced by orxonox::QuestManager::addSubQuest().
bool orxonox::Quest::isActive | ( | const PlayerInfo * | player | ) | const |
Returns true if the quest status for the specific player is 'active'.
player | The player. |
Throws | an exception if getStatus throws one. |
References orxonox::QuestStatus::Active, and getStatus().
Referenced by orxonox::QuestManager::addSubQuest(), and orxonox::QuestHint::setActive().
virtual bool orxonox::Quest::isCompletable | ( | const PlayerInfo * | player | ) | const [protected, pure virtual] |
Checks whether the Quest can be completed.
Implemented in orxonox::GlobalQuest, and orxonox::LocalQuest.
bool orxonox::Quest::isCompleted | ( | const PlayerInfo * | player | ) | const |
Returns true if the quest status for the specific player is 'completed'.
player | The player. |
Throws | an exception if getStatus throws one. |
References orxonox::QuestStatus::Completed, and getStatus().
Referenced by orxonox::QuestManager::addSubQuest().
virtual bool orxonox::Quest::isFailable | ( | const PlayerInfo * | player | ) | const [protected, pure virtual] |
Checks whether the Quest can be failed.
Implemented in orxonox::GlobalQuest, and orxonox::LocalQuest.
bool orxonox::Quest::isFailed | ( | const PlayerInfo * | player | ) | const |
Returns true if the quest status for the specific player is 'failed'.
player | The player. |
Throws | an exception if getStatus throws one. |
References orxonox::QuestStatus::Failed, and getStatus().
Referenced by orxonox::QuestManager::addSubQuest().
bool orxonox::Quest::isInactive | ( | const PlayerInfo * | player | ) | const |
Returns true if the quest status for the specific player is 'inactive'.
player | The player. |
Throws | an exception if getStatus throws one. |
References getStatus(), and orxonox::QuestStatus::Inactive.
Referenced by orxonox::QuestManager::addSubQuest(), orxonox::QuestManager::getRootQuests(), orxonox::LocalQuest::isStartable(), and orxonox::GlobalQuest::isStartable().
virtual bool orxonox::Quest::isStartable | ( | const PlayerInfo * | player | ) | const [protected, pure virtual] |
Checks whether the Quest can be started.
Implemented in orxonox::GlobalQuest, and orxonox::LocalQuest.
Referenced by start().
bool orxonox::Quest::setParentQuest | ( | Quest * | quest | ) | [private] |
Sets the parentquest of the Quest.
quest | A pointer to the Quest to be set as parentquest. |
< We don't want to set NULL-Pointers.
References COUT, orxonox::QuestItem::getId(), and parentQuest_.
Referenced by addSubQuest().
virtual bool orxonox::Quest::setStatus | ( | PlayerInfo * | player, | |
const QuestStatus::Value & | status | |||
) | [protected, pure virtual] |
Changes the status for a specific player.
Implemented in orxonox::GlobalQuest, and orxonox::LocalQuest.
Referenced by complete(), fail(), and start().
bool orxonox::Quest::start | ( | PlayerInfo * | player | ) |
Sets a Quest to active.
Starts the Quest for an input player.
player | The player. |
< Checks whether the quest can be started.
< Tells the QuestListeners, that the status has changed to active.
References orxonox::QuestStatus::Active, orxonox::QuestListener::advertiseStatusChange(), COUT, orxonox::QuestItem::getDescription(), orxonox::QuestItem::getId(), isStartable(), listeners_, orxonox::QuestDescription::sendAddQuestNotification(), and setStatus().
Referenced by orxonox::AddQuest::invoke().
void orxonox::Quest::XMLPort | ( | Element & | xmlelement, | |
XMLPort::Mode | mode | |||
) | [virtual] |
Method for creating a Quest object through XML.
<Registers the Quest with the QuestManager.
Reimplemented from orxonox::QuestItem.
Reimplemented in orxonox::GlobalQuest, and orxonox::LocalQuest.
References addCompleteEffect(), addFailEffect(), addHint(), addSubQuest(), getCompleteEffect(), getFailEffect(), getHint(), orxonox::QuestManager::getInstance(), getSubQuest(), orxonox::QuestManager::registerQuest(), SUPER, and XMLPortObject.
std::list<QuestEffect*> orxonox::Quest::completeEffects_ [private] |
A list of QuestEffects to be invoked, when the Quest has been completed.
Referenced by addCompleteEffect(), and getCompleteEffect().
std::list<QuestEffect*> orxonox::Quest::failEffects_ [private] |
A list of all QuestEffects to be invoked, when the Quest has been failed.
Referenced by addFailEffect(), and getFailEffect().
std::list<QuestHint*> orxonox::Quest::hints_ [private] |
std::list<QuestListener*> orxonox::Quest::listeners_ [private] |
A list of QuestListeners, that listen to what exactly happens with this Quest.
Referenced by addListener(), complete(), fail(), and start().
Quest* orxonox::Quest::parentQuest_ [private] |
std::list<Quest*> orxonox::Quest::subQuests_ [private] |