Emergency 20 Dokumentation  4.2.0
em5::MessageObjectiveObserver Class Reference

EMERGENCY 5 generic message observer. More...

#include <MessageObjectiveObserver.h>

Inheritance diagram for em5::MessageObjectiveObserver:
em5::Observer qsf::GameLogic qsf::WeakPtrTarget em5::BombExplosionObserver em5::CutVegetationObserver em5::DefuseBombObserver em5::DestroyedVehicleObserver em5::ForcePersonFromVehicleObserver em5::FreePersonFromBuildingObserver em5::GangsterEscapedObserver em5::LiftUpByCraneObserver em5::PersonArrestedObserver em5::PersonExitsVehicleObserver em5::PickupPersonWithRescueHelicopterObserver em5::TookPersonOutsideObserver em5::TransportedToHqObserver em5::TreatPersonObserver

Public Types

enum  Reaction {
  Reaction::NONE = 0, Reaction::OBJECTIVE_DEC_CURRENT, Reaction::OBJECTIVE_INC_CURRENT, Reaction::OBJECTIVE_DEC_NEEDED,
  Reaction::OBJECTIVE_INC_NEEDED
}
 

Public Member Functions

 MessageObjectiveObserver ()
 Default constructor. More...
 
void initWithObjective (const qsf::MessageConfiguration &messageConfiguration, Objective &objective, Reaction reaction, bool removeAfterTrigger=true)
 Initialize this observer with a message to listen to and an objective to manipulate. More...
 
void addMessage (const qsf::MessageConfiguration &messageConfiguration)
 
virtual bool onStartup () override
 Start up the game logic. More...
 
virtual void onShutdown () override
 Shut down the game logic. More...
 
virtual void serialize (qsf::BinarySerializer &serializer) override
 Serialize or deserialize the game logic using a binary serializer. More...
 
virtual bool checkIncomingMessage (const qsf::MessageParameters &parameters)
 Callback for sub-class implementations: return "false" to ignore this incoming message. More...
 
- Public Member Functions inherited from em5::Observer
virtual ~Observer ()
 Destructor. More...
 
const std::string & getName () const
 Get the observer's name. More...
 
void setName (const std::string &name)
 Set the observer's name; the name has no special meaning internally, use it as you like, e.g. to identify a single observer. More...
 
- Public Member Functions inherited from qsf::GameLogic
virtual ~GameLogic ()
 Destructor. More...
 
uint32 getId () const
 Get the game logic's unique ID. More...
 
uint32 getTypeId () const
 Get the game logic's type ID. More...
 
uint64 getEntityId () const
 Get the owning entity's ID or zero if there is none. More...
 
EntitygetEntity () const
 Get the owning entity or a null pointer if there is none. More...
 
EntitygetEntitySafe () const
 Get the owning entity or a null pointer if there is none. More...
 
MapgetMap () const
 Get the associated map of the game logic. More...
 
bool startup ()
 Startup the game logic. More...
 
bool isRunning () const
 Return whether or not the game logic is up-and-running. More...
 
void shutdown ()
 Shutdown the game logic. More...
 
bool isDebug () const
 Return whether or not the logic is considered to be in debug mode. More...
 
void setDebug (bool debugMode)
 Set whether or not the logic is considered to be in debug mode. More...
 

Static Public Attributes

static const uint32 GAMELOGIC_TYPE_ID
 

Protected Member Functions

 MessageObjectiveObserver (uint32 gameLogicTypeId)
 Constructor for sub-classes. More...
 
- Protected Member Functions inherited from em5::Observer
 Observer (uint32 typeId)
 Constructor. More...
 
FreeplayEventgetParentEvent () const
 Get parent event. More...
 
template<typename T >
T & createObserver (uint64 entityId)
 Create observer. More...
 
template<typename T >
T * getObserver (uint64 entityId)
 Get observer. More...
 
- Protected Member Functions inherited from qsf::GameLogic
virtual void onSetDebug (bool debug)
 Set whether or not the logic is considered to be in debug mode. More...
 
void removeThis ()
 
 GameLogic (uint32 typeId)
 Constructor. More...
 
void registrationAtManager (GameLogicManager &manager, uint32 id)
 Registering call from manager. More...
 
- Protected Member Functions inherited from qsf::WeakPtrTarget
 WeakPtrTarget ()
 Default constructor. More...
 
 WeakPtrTarget (const WeakPtrTarget &other)
 Copy constructor. More...
 
 WeakPtrTarget (WeakPtrTarget &&)=delete
 Delete the move constructor, as WeakPtrTarget would need a proper move constructor-implementation that ensures that its pointer gets updated in the WeakPtrBase as well. More...
 
 ~WeakPtrTarget ()
 Destructor. More...
 
void invalidateAllWeakPtr ()
 Invalidate all weak pointers to this object. More...
 
void operator= (const WeakPtrTarget &other)
 Copy operator. More...
 

Detailed Description

EMERGENCY 5 generic message observer.

Note
  • This observer is listening to an arbitrary message
  • It is a game logic instance inside the entity affected by the message

Member Enumeration Documentation

Enumerator
NONE 
OBJECTIVE_DEC_CURRENT 
OBJECTIVE_INC_CURRENT 
OBJECTIVE_DEC_NEEDED 
OBJECTIVE_INC_NEEDED 

Constructor & Destructor Documentation

em5::MessageObjectiveObserver::MessageObjectiveObserver ( )

Default constructor.

em5::MessageObjectiveObserver::MessageObjectiveObserver ( uint32  gameLogicTypeId)
explicitprotected

Constructor for sub-classes.

Member Function Documentation

void em5::MessageObjectiveObserver::addMessage ( const qsf::MessageConfiguration messageConfiguration)
virtual bool em5::MessageObjectiveObserver::checkIncomingMessage ( const qsf::MessageParameters parameters)
inlinevirtual

Callback for sub-class implementations: return "false" to ignore this incoming message.

void em5::MessageObjectiveObserver::initWithObjective ( const qsf::MessageConfiguration messageConfiguration,
Objective objective,
Reaction  reaction,
bool  removeAfterTrigger = true 
)

Initialize this observer with a message to listen to and an objective to manipulate.

Parameters
[in]messageConfigurationThe message to listen to
[in]objectiveThe objective instance to connect to
[in]reactionDefines what to do with the objective when the message triggers
[in]removeAfterTriggerIf "true", this observer will get removed after its message triggered
virtual void em5::MessageObjectiveObserver::onShutdown ( )
overridevirtual

Shut down the game logic.

Reimplemented from em5::Observer.

virtual bool em5::MessageObjectiveObserver::onStartup ( )
overridevirtual

Start up the game logic.

Reimplemented from em5::Observer.

virtual void em5::MessageObjectiveObserver::serialize ( qsf::BinarySerializer serializer)
overridevirtual

Serialize or deserialize the game logic using a binary serializer.

Parameters
[in]serializerThe serializer, which can be either in read or write mode

Reimplemented from qsf::GameLogic.

Member Data Documentation

const uint32 em5::MessageObjectiveObserver::GAMELOGIC_TYPE_ID
static

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