Emergency 20 Dokumentation  4.2.0
em5::Objective Class Reference

EMERGENCY 5 objective class. More...

#include <Objective.h>

Inheritance diagram for em5::Objective:

Public Types

enum  ObjectiveType { OBJECTIVETYPE_REQUIRED, OBJECTIVETYPE_FAILCONDITION, OBJECTIVETYPE_OPTIONAL, OBJECTIVETYPE_OPTIONAL_FAILED }
 
typedef boost::container::flat_set< uint64EntityIdSet
 
typedef std::array< uint16, 4 > PlayerCountMap
 

Public Member Functions

 Objective (uint32 typeId, ObjectiveType type, uint32 eventId)
 Constructor. More...
 
 Objective (qsf::BinarySerializer &serializer)
 Constructor for serialization. More...
 
virtual ~Objective ()
 Destructor. More...
 
uint32 getId () const
 
uint32 getTypeId () const
 
uint32 getFreeplayEventId ()
 Get freeplay event ID. More...
 
ObjectiveType getObjectiveType () const
 
void setObjectiveType (ObjectiveType type)
 
const std::string & getText () const
 Get the current objective text of this objective. More...
 
void setText (const std::string &text)
 Set the objective text. More...
 
uint32 getCurrentNumber () const
 
void setCurrentNumber (uint32 number)
 
uint32 getNeededNumber () const
 
void setNeededNumber (uint32 number)
 
bool isCurrentEntity (qsf::Entity &entity) const
 
bool isNeededEntity (qsf::Entity &entity) const
 
const EntityIdSetgetCurrentEntityIdSet () const
 
const EntityIdSetgetNeededEntityIdSet () const
 
void increaseCurrentNumber (qsf::Entity *entity=nullptr)
 Increase the current number and delete entity ID. More...
 
void decreaseCurrentNumber (qsf::Entity *entity=nullptr)
 Decrease the current number and add entity ID. More...
 
void increaseNeededNumber (qsf::Entity *entity=nullptr)
 Increase the needed number and add entity ID. More...
 
void decreaseNeededNumber (qsf::Entity *entity=nullptr)
 Decrease the needed number and remove entity ID. More...
 
bool checkAccomplished () const
 
void setAccomplished ()
 
uint64 getRandomCurrentEntityId () const
 Get random entity ID of current entities, or qsf::getUninitialized<uint64>() if there is none. More...
 
uint64 getRandomNeededEntityId () const
 Get random entity ID of needed entities, or qsf::getUninitialized<uint64>() if there is none. More...
 
bool isHidden () const
 
void setHidden (bool hidden)
 
uint32 getOrderPriority () const
 
void setOrderPriority (uint32 orderPriority)
 
void updateObjectiveProcess ()
 Check if the objective is accomplished and inform the freeplay event about this (for objective individual point calculation) More...
 
const PlayerCountMapgetPlayerCountMap () const
 
void fulfillNonexistingNeededEntities (qsf::Map &map)
 
void serialize (qsf::BinarySerializer &serializer)
 

Static Public Member Functions

static ObjectivegetObjectiveById (uint32 id)
 

Friends

class ObjectiveHelper
 
class ObjectiveManager
 

Detailed Description

EMERGENCY 5 objective class.

Remarks
An objective is a task or "quest" the player has to accomplish as part of an event. There is also the objective type "fail condition" to cover not only conditions for successfully solving an event, but also for failure.

Member Typedef Documentation

typedef boost::container::flat_set<uint64> em5::Objective::EntityIdSet
typedef std::array<uint16, 4> em5::Objective::PlayerCountMap

Member Enumeration Documentation

Objective type

Enumerator
OBJECTIVETYPE_REQUIRED 

Objective is required for success.

OBJECTIVETYPE_FAILCONDITION 

Objective is a fail condition, and will lead to a failure if accomplished.

OBJECTIVETYPE_OPTIONAL 

Objective is optional (irrelevant for success) and still open.

OBJECTIVETYPE_OPTIONAL_FAILED 

Objective is optional (irrelevant for success) and failed.

Constructor & Destructor Documentation

em5::Objective::Objective ( uint32  typeId,
ObjectiveType  type,
uint32  eventId 
)

Constructor.

em5::Objective::Objective ( qsf::BinarySerializer serializer)
explicit

Constructor for serialization.

virtual em5::Objective::~Objective ( )
virtual

Destructor.

Member Function Documentation

bool em5::Objective::checkAccomplished ( ) const
inline
void em5::Objective::decreaseCurrentNumber ( qsf::Entity entity = nullptr)

Decrease the current number and add entity ID.

Parameters
[in]entityThis is the entity that has to be added; if it is a "nullptr" just decrease current number
void em5::Objective::decreaseNeededNumber ( qsf::Entity entity = nullptr)

Decrease the needed number and remove entity ID.

Parameters
[in]entityThis is the entity that has to be removed; if it is a "nullptr" just decrease needed number
void em5::Objective::fulfillNonexistingNeededEntities ( qsf::Map map)
const Objective::EntityIdSet & em5::Objective::getCurrentEntityIdSet ( ) const
inline
uint32 em5::Objective::getCurrentNumber ( ) const
inline
uint32 em5::Objective::getFreeplayEventId ( )
inline

Get freeplay event ID.

uint32 em5::Objective::getId ( ) const
inline
const Objective::EntityIdSet & em5::Objective::getNeededEntityIdSet ( ) const
inline
uint32 em5::Objective::getNeededNumber ( ) const
inline
static Objective* em5::Objective::getObjectiveById ( uint32  id)
static
Objective::ObjectiveType em5::Objective::getObjectiveType ( ) const
inline
uint32 em5::Objective::getOrderPriority ( ) const
inline
const Objective::PlayerCountMap & em5::Objective::getPlayerCountMap ( ) const
inline
uint64 em5::Objective::getRandomCurrentEntityId ( ) const

Get random entity ID of current entities, or qsf::getUninitialized<uint64>() if there is none.

uint64 em5::Objective::getRandomNeededEntityId ( ) const

Get random entity ID of needed entities, or qsf::getUninitialized<uint64>() if there is none.

const std::string & em5::Objective::getText ( ) const
inline

Get the current objective text of this objective.

uint32 em5::Objective::getTypeId ( ) const
inline
void em5::Objective::increaseCurrentNumber ( qsf::Entity entity = nullptr)

Increase the current number and delete entity ID.

Parameters
[in]entityThis is the entity that has to be deleted; if it is a "nullptr" just increase current number
void em5::Objective::increaseNeededNumber ( qsf::Entity entity = nullptr)

Increase the needed number and add entity ID.

Parameters
[in]entityThis is the entity that has to be added; if it is a "nullptr" just increase needed number
bool em5::Objective::isCurrentEntity ( qsf::Entity entity) const
bool em5::Objective::isHidden ( ) const
inline
bool em5::Objective::isNeededEntity ( qsf::Entity entity) const
void em5::Objective::serialize ( qsf::BinarySerializer serializer)
void em5::Objective::setAccomplished ( )
void em5::Objective::setCurrentNumber ( uint32  number)
void em5::Objective::setHidden ( bool  hidden)
inline
void em5::Objective::setNeededNumber ( uint32  number)
void em5::Objective::setObjectiveType ( ObjectiveType  type)
inline
void em5::Objective::setOrderPriority ( uint32  orderPriority)
inline
void em5::Objective::setText ( const std::string &  text)
inline

Set the objective text.

void em5::Objective::updateObjectiveProcess ( )

Check if the objective is accomplished and inform the freeplay event about this (for objective individual point calculation)

Friends And Related Function Documentation

friend class ObjectiveHelper
friend
friend class ObjectiveManager
friend

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