QuestWeaver
A procedural quest generator
weave::Quest Class Referenceabstract

Represents a game quest. More...

#include <Quest.h>

Public Member Functions

 Quest (const std::string &title, const std::string &description)
 Initializes a new quest with the given title and description (and an empty story) More...
 
 Quest (const std::string &title, const std::string &description, const std::string &story)
 Initializes a new quest with the given title, description and story. More...
 
virtual ~Quest ()
 
std::string GetDescription () const
 Returns the quest's description. More...
 
ID GetId () const
 Returns the quest's unique ID. More...
 
std::string GetStory () const
 Returns the quest's backstory. More...
 
std::string GetTitle () const
 Returns the quest's title. More...
 
virtual std::string GetType () const =0
 Returns the type of the quest. More...
 
virtual QuestTickResult Tick (float delta, const WorldModel &worldModel)
 This method is called whenever the main quest system is ticked. More...
 

Static Public Attributes

static const ID NoID = 0
 Quests not registered with the quest system have this id. More...
 

Protected Member Functions

 Quest (ID id, const std::string &title, const std::string &description, const std::string &story)
 
cereal::NameValuePair< const std::string & > getCerealDescription () const
 
cereal::NameValuePair< const ID & > getCerealId () const
 
cereal::NameValuePair< const std::string & > getCerealStory () const
 
cereal::NameValuePair< const std::string & > getCerealTitle () const
 

Detailed Description

Represents a game quest.

Instances of this class are immutable. The associated quest state can be changed from within the quest once it is ticked by the quest system.

Definition at line 106 of file Quest.h.

Constructor & Destructor Documentation

weave::Quest::Quest ( const std::string &  title,
const std::string &  description 
)

Initializes a new quest with the given title and description (and an empty story)

weave::Quest::Quest ( const std::string &  title,
const std::string &  description,
const std::string &  story 
)

Initializes a new quest with the given title, description and story.

virtual weave::Quest::~Quest ( )
inlinevirtual

Definition at line 126 of file Quest.h.

weave::Quest::Quest ( ID  id,
const std::string &  title,
const std::string &  description,
const std::string &  story 
)
protected

Member Function Documentation

cereal::NameValuePair<const std::string &> weave::Quest::getCerealDescription ( ) const
inlineprotected

Definition at line 182 of file Quest.h.

cereal::NameValuePair<const ID &> weave::Quest::getCerealId ( ) const
inlineprotected

Definition at line 174 of file Quest.h.

cereal::NameValuePair<const std::string &> weave::Quest::getCerealStory ( ) const
inlineprotected

Definition at line 186 of file Quest.h.

cereal::NameValuePair<const std::string &> weave::Quest::getCerealTitle ( ) const
inlineprotected

Definition at line 178 of file Quest.h.

std::string weave::Quest::GetDescription ( ) const

Returns the quest's description.

ID weave::Quest::GetId ( ) const

Returns the quest's unique ID.

std::string weave::Quest::GetStory ( ) const

Returns the quest's backstory.

std::string weave::Quest::GetTitle ( ) const

Returns the quest's title.

virtual std::string weave::Quest::GetType ( ) const
pure virtual

Returns the type of the quest.

This method is implemented by subclasses which return a unique quest type.

virtual QuestTickResult weave::Quest::Tick ( float  delta,
const WorldModel worldModel 
)
virtual

This method is called whenever the main quest system is ticked.

It allows subclasses to react to game events and queue changes via the QuestTickResult. Only ACTIVE quests can be ticked!

Parameters
deltaThe time elapsed since the last tick.
worldModelThe world model, which can be used to search and check world entities. Changing them is only possible by returning the change in the result.

Member Data Documentation

const ID weave::Quest::NoID = 0
static

Quests not registered with the quest system have this id.

Definition at line 111 of file Quest.h.


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