Emergency 20 Dokumentation  4.2.0
em5::EventIdComponent Class Reference

EMERGENCY 5 event ID component class. More...

#include <EventIdComponent.h>

Inheritance diagram for em5::EventIdComponent:
qsf::Component qsf::InheritedObject qsf::WeakPtrTarget qsf::Object

Public Member Functions

 EventIdComponent (qsf::Prototype *prototype)
 Constructor. More...
 
 ~EventIdComponent ()
 Destructor. More...
 
uint32 getEventId () const
 Get event ID. More...
 
FreeplayEventgetFreeplayEvent () const
 Return the registered event (could be nullptr!) More...
 
bool setEvent (FreeplayEvent &freeplayEvent, eventspreadreason::Reason eventSpreadReason)
 Set the event ID and register at this event; once the ID is set it won't be changed. More...
 
void setEvent (FreeplayEvent &freeplayEvent)
 Set the event ID once the ID is set it won't be changed. More...
 
void lockForTeam (uint64 unitEntityId, uint16 teamId)
 
void releaseTeamLock (uint64 unitEntityId, uint16 teamId)
 
bool isUnlockedForTeam (uint16 teamId)
 
uint16 getCurrentTeamId () const
 
void setCurrentTeamId (uint16 teamId)
 
virtual void serialize (qsf::BinarySerializer &serializer) override
 Serialize or deserialize the component using a binary serializer. More...
 
virtual bool onStartup () override
 Startup the component. More...
 
virtual void onShutdown () override
 Shutdown the component. More...
 
- Public Member Functions inherited from qsf::Component
virtual ~Component ()
 Destructor. More...
 
PrototypegetPrototype () const
 Return the prototype this component is in. More...
 
EntitygetEntity () const
 Return a reference to the entity this component is in. More...
 
uint32 getId () const
 Return the unique component identifier. More...
 
ComponentManagergetComponentManager () const
 Return the component manager that's responsible for this component instance. More...
 
ComponentCollectiongetComponentCollection () const
 Return the component collection that's responsible for this component instance. More...
 
bool isSimulating () const
 Return whether or not the component is in simulating mode. More...
 
bool isActive () const
 Return whether or not the component is considered to be active. More...
 
void setActive (bool active)
 Set whether or not the component is considered to be active. More...
 
bool isDebug () const
 Return whether or not the component is considered to be in debug mode. More...
 
bool isHidden () const
 Return whether or not the component is hidden. More...
 
void setHidden (bool hidden)
 Set whether or not the component is hidden. More...
 
bool isGloballyHidden () const
 Return whether or not the component is globally hidden. More...
 
void setGloballyHidden (bool globallyHidden)
 Set whether or not the component is globally hidden. More...
 
bool isReallyHidden () const
 Return whether or not the component is really hidden. More...
 
bool startup (bool ownerIsRunning)
 Startup the component. More...
 
bool isRunning () const
 Return whether or not the component is up-and-running. More...
 
void shutdown ()
 Shutdown the component. More...
 
uint64 getPrototypeId () const
 Return the ID of the prototype this component is in. More...
 
uint64 getEntityId () const
 Return the ID of the entity this component is in. More...
 
virtual void onInvalidation ()
 Invalidate the component. More...
 
virtual void setDebug (bool debugMode)
 Set whether or not the component is considered to be in debug mode. More...
 
- Public Member Functions inherited from qsf::InheritedObject
void copyPropertyOverrideStateFrom (const InheritedObject &object, bool add=false)
 
void setAllPropertyOverrideFlags (bool value)
 
void autoCreatePropertyOverrideState ()
 
virtual camp::Value getPropertyDefaultValue (const StringHash &propertyId) const override
 
virtual PropertyOverrideState getPropertyOverrideState (const StringHash &propertyId) const override
 
virtual bool setPropertyOverrideState (const StringHash &propertyId, PropertyOverrideState overrideState) override
 
- Public Member Functions inherited from qsf::Object
virtual ~Object ()
 Destructor. More...
 
const camp::Class & getCampClass () const
 Return the CAMP class. More...
 
int getPropertyIndexById (const StringHash &propertyId) const
 Return the CAMP property index by using the unique class property ID. More...
 
uint32 getPropertyIdByIndex (int index) const
 Return the unique class property ID with the given index. More...
 
std::string getPropertyNameById (const StringHash &propertyId) const
 Return the CAMP property name by using the unique class property ID. More...
 
const camp::Property * getCampPropertyById (const StringHash &propertyId) const
 Return the CAMP property by using the unique class property ID. More...
 
void setPropertyValuesByString (const std::string &values)
 Set CAMP reflection property values by using a given string. More...
 
void setPropertiesToDefaultValues ()
 Set all CAMP reflection system properties to their default values. More...
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
void serializeToBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void deserializeFromBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL, bool setOverrideState=true)
 
virtual void onPreDeserialize ()
 Called right before the object is deserialized using any of the above methods. Default implementation is empty. More...
 
virtual void onPostDeserialize ()
 Called right after the object was deserialized using any of the above methods. Default implementation is empty. More...
 
virtual ScriptgetAssociatedScript () const
 Return the script instance associated with this object instance. More...
 

Static Public Member Functions

static bool addToEvent (qsf::Entity &entity, FreeplayEvent &freeplayEvent, eventspreadreason::Reason reason)
 
static bool tryLockForTeam (const qsf::Entity &targetEntity, const qsf::Entity &unitEntity)
 Tries to lock the event object to the team. More...
 
static void releaseTeamLock (const qsf::Entity &targetEntity, const qsf::Entity &unitEntity)
 Releases a team lock. More...
 
static void releaseTeamLock (uint64 targetEntityId, qsf::Entity &unitEntity)
 Releases a team lock. More...
 
static bool isUnlockedForTeam (const qsf::Entity &targetEntity, const qsf::Entity &unitEntity)
 Check if the event object is not locked for the team. More...
 
static bool isUnlockedForTeam (const qsf::Entity &targetEntity, uint16 teamId)
 Check if the event object is not locked for the team. More...
 
static void registerPlayer (const qsf::Entity &targetEntity, const qsf::Entity &unitEntity)
 Registers the player at the event object as "has interacted with". More...
 

Static Public Attributes

static const uint32 COMPONENT_ID
 "em5::EventIdComponent" unique component ID More...
 
- Static Public Attributes inherited from qsf::Component
static const uint32 COMPONENT_ID
 "qsf::Component" unique component ID More...
 

Friends

class Objective
 

Additional Inherited Members

- Public Types inherited from qsf::Component
enum  TransformChangeFlag {
  TRANSFORM_CHANGE_POSITION = 0x01, TRANSFORM_CHANGE_ROTATION = 0x02, TRANSFORM_CHANGE_SCALE = 0x04, TRANSFORM_CHANGE_TRANSFORM = 0x07,
  TRANSFORM_CHANGE_FOR_SIMULATION = 0x08, TRANSFORM_CHANGE_FOR_ANIMATION = 0x10
}
 
typedef BitFlagSet< uint8, TransformChangeFlagTransformChangeFlags
 
- Public Types inherited from qsf::Object
enum  PropertyOverrideState { PROPERTY_INVALID, PROPERTY_DEFAULT, PROPERTY_OVERRIDE, PROPERTY_REMOVED }
 
enum  SerializationMethod { SERIALIZE_FLAT, SERIALIZE_COMPLETE, SERIALIZE_DIFFERENTIAL, SERIALIZE_IGNORE_UNKNOWN }
 
enum  SerializationMode { MODE_MINIMAL, MODE_COMPATIBLE }
 
- Protected Member Functions inherited from qsf::Component
 Component (Prototype *prototype)
 Constructor. More...
 
void promotePropertyChange (uint32 propertyId)
 A component property value was changed. More...
 
template<typename T , typename S >
bool assignAndPromoteChange (T &variable, const S &newValue, uint32 propertyId)
 Comfort function for updating an exported member variable and promoting any change that happened. More...
 
void setRegisterForSimulationTransformChanges (bool enable)
 Register or unregister this component as simulation transform listener. More...
 
void setRegisterForAnimationTransformChanges (bool enable)
 Register or unregister this component as animation transform listener. More...
 
virtual const ObjectgetPropertyDefaultsProvider () const override
 
virtual bool ignoreOwnerRunningState () const
 Return whether or not the component will only startup if the owner is in running state. More...
 
virtual bool implementsOnComponentPropertyChange () const
 Signal whether this component needs the "onComponentPropertyChange" callback at all. More...
 
virtual void onComponentPropertyChange (const Component &component, uint32 propertyId)
 Called in case a component property value was changed. More...
 
virtual void onComponentTransformChange (const Transform &transform, TransformChangeFlags flags)
 Called in case a component transformation value was changed. More...
 
virtual void onSetSimulating (bool simulating)
 Set whether or not the component is in simulating mode. More...
 
virtual void onSetActive (bool active)
 Set whether or not the component is considered to be active. More...
 
virtual void onSetDebug (bool debug)
 Set whether or not the component is considered to be in debug mode. More...
 
virtual void onSetHidden (bool hidden)
 Set whether or not the component is considered to be hidden. More...
 
- Protected Member Functions inherited from qsf::InheritedObject
 InheritedObject ()
 Default constructor. More...
 
- Protected Member Functions inherited from qsf::Object
 Object ()
 Default constructor. 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...
 
- Protected Attributes inherited from qsf::InheritedObject
std::bitset< 128 > mPropertyOverrideFlags
 One bit for each property; if set, the property is overridden. More...
 

Detailed Description

EMERGENCY 5 event ID component class.

Constructor & Destructor Documentation

em5::EventIdComponent::EventIdComponent ( qsf::Prototype prototype)
explicit

Constructor.

em5::EventIdComponent::~EventIdComponent ( )
inline

Destructor.

Member Function Documentation

static bool em5::EventIdComponent::addToEvent ( qsf::Entity entity,
FreeplayEvent freeplayEvent,
eventspreadreason::Reason  reason 
)
static
uint16 em5::EventIdComponent::getCurrentTeamId ( ) const
uint32 em5::EventIdComponent::getEventId ( ) const

Get event ID.

FreeplayEvent * em5::EventIdComponent::getFreeplayEvent ( ) const
inline

Return the registered event (could be nullptr!)

static bool em5::EventIdComponent::isUnlockedForTeam ( const qsf::Entity targetEntity,
const qsf::Entity unitEntity 
)
static

Check if the event object is not locked for the team.

Parameters
[in]targetEntityThe entity for which the event object lock should be checked
[in]unitEntityThe unit entity which wants to check the lock
Returns
"true" if the lock is free for the team, "false" otherwise
Note
The locking is a kind of "reference counting", when multiple units from the same team acquires the lock, then the lock is then unlocked, when all units release the lock This check returns also true when the event object is locked, but both units are from the same team
static bool em5::EventIdComponent::isUnlockedForTeam ( const qsf::Entity targetEntity,
uint16  teamId 
)
static

Check if the event object is not locked for the team.

Parameters
[in]targetEntityThe entity id for which the event object lock should be checked
[in]teamIdThe team id to check
Returns
"true" if the lock is free for the team, "false" otherwise
Note
The locking is a kind of "reference counting", when multiple units from the same team acquires the lock, then the lock is then unlocked, when all units release the lock This check returns also true when the event object is locked, but the asking unit is in the team which holds the lock
bool em5::EventIdComponent::isUnlockedForTeam ( uint16  teamId)
void em5::EventIdComponent::lockForTeam ( uint64  unitEntityId,
uint16  teamId 
)
virtual void em5::EventIdComponent::onShutdown ( )
overridevirtual

Shutdown the component.

Note
  • Only called in case "onStartup()" returned successfully
  • The default implementation is empty

Reimplemented from qsf::Component.

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

Startup the component.

Returns
"true" if all went fine, else "false"
Note
  • The default implementation is empty
  • Only components which are part of entities (concrete prototype instances) get started
  • When this method gets called, the properties might still be on default values but it's also possible that properties already have customized values. Take this into account when implementing your method.

Reimplemented from qsf::Component.

static void em5::EventIdComponent::registerPlayer ( const qsf::Entity targetEntity,
const qsf::Entity unitEntity 
)
static

Registers the player at the event object as "has interacted with".

Parameters
[in]targetEntityThe entity for which the registration of the player should be done
[in]unitEntityThe unit entity which holds the information about the player to register
Note
This information is used to know which player has interacted with the event object when the per objective points are distributed
static void em5::EventIdComponent::releaseTeamLock ( const qsf::Entity targetEntity,
const qsf::Entity unitEntity 
)
static

Releases a team lock.

Parameters
[in]targetEntityThe entity for which the event object should be released
[in]unitEntityThe unit entity which wants to release the lock for the team
Note
The locking is a kind of "reference counting", when multiple units from the same team acquires the lock, then the lock is then unlocked, when all units release the lock
static void em5::EventIdComponent::releaseTeamLock ( uint64  targetEntityId,
qsf::Entity unitEntity 
)
static

Releases a team lock.

Parameters
[in]targetEntityIdThe entity id for which the event object should be released
[in]unitEntityThe unit entity which wants to release the lock for the team
Note
The locking is a kind of "reference counting", when multiple units from the same team acquires the lock, then the lock is then unlocked, when all units release the lock
void em5::EventIdComponent::releaseTeamLock ( uint64  unitEntityId,
uint16  teamId 
)
virtual void em5::EventIdComponent::serialize ( qsf::BinarySerializer serializer)
overridevirtual

Serialize or deserialize the component using a binary serializer.

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

Reimplemented from qsf::Component.

void em5::EventIdComponent::setCurrentTeamId ( uint16  teamId)
bool em5::EventIdComponent::setEvent ( FreeplayEvent freeplayEvent,
eventspreadreason::Reason  eventSpreadReason 
)

Set the event ID and register at this event; once the ID is set it won't be changed.

Parameters
[in]freeplayEventEvent ID to set
[in]eventSpreadReasonEvent spreading reason; this is usually an enum value
Returns
"true" if this entity is already part of the event or the event is succesfully created, "false" otherwise
void em5::EventIdComponent::setEvent ( FreeplayEvent freeplayEvent)

Set the event ID once the ID is set it won't be changed.

Parameters
[in]freeplayEventEvent ID to set
Note
This method sets only the event id. This method is only used for multiplay on the multiplay client side
static bool em5::EventIdComponent::tryLockForTeam ( const qsf::Entity targetEntity,
const qsf::Entity unitEntity 
)
static

Tries to lock the event object to the team.

Parameters
[in]targetEntityThe entity for which the event object should be acquired
[in]unitEntityThe unit entity which wants to acquire the lock for the team
Returns
"true" if the lock was acquired, "false" otherwise
Note
The locking is a kind of "reference counting", when multiple units from the same team acquires the lock, then the lock is then unlocked, when all units release the lock

Friends And Related Function Documentation

friend class Objective
friend

Member Data Documentation

const uint32 em5::EventIdComponent::COMPONENT_ID
static

"em5::EventIdComponent" unique component ID


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