Emergency 20 Dokumentation  4.2.0
em5::FreeplayEventFactory Class Referenceabstract

EMERGENCY 5 freeplay event factory base class. More...

#include <FreeplayEventFactory.h>

Inheritance diagram for em5::FreeplayEventFactory:
qsf::Object em5::Arsonist01EventFactory em5::Arsonist02EventFactory em5::BoatFireEventFactory em5::BomberEventFactory em5::BuildingCollapseEventFactory em5::BuildingFireEventFactory em5::BuildingNearlyCollapseEventFactory em5::BuildingProtectionEventFactory em5::BuriedPersonEventFactory em5::BurningBeerTentEventFactory em5::CarTheftEventFactory em5::CityBlackoutEventFactory em5::ComplexFireEventFactory em5::DefectEboxEventFactory em5::DemonstrationEventFactory em5::DemonstrationMobEventFactory em5::DirtyBombEventFactory em5::DrunkenOverboardEventFactory em5::DrunkRiotAtBeerTentEventFactory em5::DummyEventFactory em5::EvacuateTrainStationEventFactory em5::FairBomberEventFactory em5::FairVisitorsWithFoodPoisoningEventFactory em5::GangsterTestEventFactory em5::GarbageFireEventFactory em5::GenericMainEventFactory em5::GrandTheftAutoEventFactory em5::HeatWaveEventFactory em5::HeistEventFactory em5::HostagesEventFactory em5::JailbreakEventFactory em5::MainEvent01Factory em5::MainEvent02Factory em5::MainEvent04Factory em5::MainEvent05Factory em5::MainEvent06Factory em5::MainEvent07Factory em5::MainEvent08Factory em5::MainEvent100Factory em5::MainEvent101Factory em5::MainEvent102Factory em5::MainEvent103Factory em5::MainEvent104Factory em5::MainEvent10Factory em5::MainEvent12Factory em5::MainEvent14Factory em5::MainEvent15Factory em5::MainEvent200Factory em5::MainEvent201Factory em5::MainEvent202Factory em5::MainEvent203Factory em5::MainEvent204Factory em5::ManhuntEventFactory em5::MedicalEmergencyEventFactory em5::MedicalInBuldingEventFactory em5::MissingPersonEventFactory em5::PickpocketEventFactory em5::PillageBuildingEventFactory em5::PlaneCrashEventFactory em5::RiotEventFactory em5::RobberyEventFactory em5::RowdyEventFactory em5::RunningAmokEventFactory em5::SabotageEventFactory em5::StormDamageEventFactory em5::TerrorAttackEventFactory em5::TrafficAccident01EventFactory em5::TrainAccidentEventFactory em5::TreeAndBushFireEventFactory em5::TutorialFactory em5::VehicleFireEventFactory em5::WeaponDealEventFactory

Public Types

typedef std::vector< boost::property_tree::ptreeVariantArray
 
- 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 }
 

Public Member Functions

 FreeplayEventFactory ()
 Constructor. More...
 
virtual ~FreeplayEventFactory ()
 Destructor. More...
 
uint32 getId () const
 Return event factory's unique ID. More...
 
const std::string & getEventName () const
 Return event's name. More...
 
bool isEnabled () const
 Return whether or not the factory is currently enabled for the game. More...
 
float getTriggerChance () const
 Return trigger chance for this event factory. More...
 
void setTriggerChance (float triggerChance)
 Set trigger chance for this event factory. More...
 
float getEventDensity () const
 Get event density. More...
 
void setEventDensity (float eventDensity)
 Set event desity. More...
 
bool getStartEvent () const
 Get start event. More...
 
void setStartEvent (bool startEvent)
 
uint32 getMaxAppearances () const
 Get limit of appearances. More...
 
void setMaxAppearances (uint32 maxAppearances)
 
const std::string & getEventTag () const
 Get the event tag (used to search the target entity) More...
 
void setEventTag (const std::string &eventTag)
 Set the event tag (used to search the target entity) More...
 
const VariantArraygetVariants () const
 Get the variants of the freeplay event factory. More...
 
void setVariants (const VariantArray &variants)
 Set the variants of the freeplay event factory. More...
 
const boost::property_tree::ptreegetRandomVariant () const
 Get a random variant of the variant array. More...
 
const boost::property_tree::ptreegetMainVariant () const
 Get a main variant of the variant array. More...
 
const boost::property_tree::ptreegetVariantByIndex (uint32 index) const
 Get a variant of the variant array by index. More...
 
bool operator== (const FreeplayEventFactory &other) const
 Compare this factory's unique ID to an other factory's unique ID. More...
 
bool operator== (const std::string &other) const
 Compare this factory's name to an std::string. More...
 
bool operator== (uint32 other) const
 Compare this factory's unique ID to a uint32. More...
 
FreeplayEventtryTriggerEvent (const FreeplayEventTriggerInfo &triggerInfo)
 Check if the event preconditions are met and if so, generate an event instance. More...
 
virtual FreeplayEventtryTriggerEvent ()=0
 
- 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 camp::Value getPropertyDefaultValue (const StringHash &propertyId) const
 
virtual PropertyOverrideState getPropertyOverrideState (const StringHash &propertyId) const
 
virtual bool setPropertyOverrideState (const StringHash &propertyId, PropertyOverrideState overrideState)
 
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...
 

Protected Member Functions

template<typename T >
T & createAndInitializeEvent ()
 
FreeplayEventcreateAndInitializeEventByClassName (const std::string &className)
 
void deserializeRandomFreeplayVariant (FreeplayEvent &freeplayEvent)
 
void deserializeFreeplayVariantByIndex (FreeplayEvent &freeplayEvent, uint32 index)
 
bool isEventAlreadyRunning () const
 
const FreeplayEventTriggerInfogetTriggerInfo () const
 
void setTriggerFailReason (const std::string &reason) const
 
qsf::LayergetCandidateEventLayer (const std::string &eventLayerName, const std::string &baseLayerName, const boost::function< bool(const qsf::Layer &)> &checkCandidateCallback) const
 Try to get a randomly chosen layer to use for a event. More...
 
- Protected Member Functions inherited from qsf::Object
 Object ()
 Default constructor. More...
 

Protected Attributes

std::string mEventTag
 

Friends

class FreeplayEventPoolManager
 

Detailed Description

EMERGENCY 5 freeplay event factory base class.

Remarks
A freeplay event factory implementation is responsible for generating freeplay event instances of its specific type, and also for checking whether the preconditions for that type of event are currently met.

Member Typedef Documentation

Constructor & Destructor Documentation

em5::FreeplayEventFactory::FreeplayEventFactory ( )

Constructor.

virtual em5::FreeplayEventFactory::~FreeplayEventFactory ( )
virtual

Destructor.

Member Function Documentation

template<typename T >
T & em5::FreeplayEventFactory::createAndInitializeEvent ( )
protected
FreeplayEvent& em5::FreeplayEventFactory::createAndInitializeEventByClassName ( const std::string &  className)
protected
void em5::FreeplayEventFactory::deserializeFreeplayVariantByIndex ( FreeplayEvent freeplayEvent,
uint32  index 
)
protected
void em5::FreeplayEventFactory::deserializeRandomFreeplayVariant ( FreeplayEvent freeplayEvent)
protected
qsf::Layer* em5::FreeplayEventFactory::getCandidateEventLayer ( const std::string &  eventLayerName,
const std::string &  baseLayerName,
const boost::function< bool(const qsf::Layer &)> &  checkCandidateCallback 
) const
protected

Try to get a randomly chosen layer to use for a event.

Parameters
[in]eventLayerNameOptional name of a layer; if not empty, this specific layer will be returned
[in]baseLayerNameName of a base layer containing sublayers that each represent an event location; one of the children will get chosen randomly
[in]checkCandidateCallbackCallback that has to check a candidate layer to return; if "false" is returned, the candidate won't be used a result
Returns
The layer or a null pointer if none could be found
float em5::FreeplayEventFactory::getEventDensity ( ) const
inline

Get event density.

const std::string & em5::FreeplayEventFactory::getEventName ( ) const
inline

Return event's name.

const std::string & em5::FreeplayEventFactory::getEventTag ( ) const
inline

Get the event tag (used to search the target entity)

uint32 em5::FreeplayEventFactory::getId ( ) const
inline

Return event factory's unique ID.

const boost::property_tree::ptree& em5::FreeplayEventFactory::getMainVariant ( ) const

Get a main variant of the variant array.

uint32 em5::FreeplayEventFactory::getMaxAppearances ( ) const
inline

Get limit of appearances.

const boost::property_tree::ptree& em5::FreeplayEventFactory::getRandomVariant ( ) const

Get a random variant of the variant array.

bool em5::FreeplayEventFactory::getStartEvent ( ) const
inline

Get start event.

float em5::FreeplayEventFactory::getTriggerChance ( ) const
inline

Return trigger chance for this event factory.

const FreeplayEventTriggerInfo& em5::FreeplayEventFactory::getTriggerInfo ( ) const
protected
const boost::property_tree::ptree& em5::FreeplayEventFactory::getVariantByIndex ( uint32  index) const

Get a variant of the variant array by index.

const FreeplayEventFactory::VariantArray & em5::FreeplayEventFactory::getVariants ( ) const
inline

Get the variants of the freeplay event factory.

bool em5::FreeplayEventFactory::isEnabled ( ) const
inline

Return whether or not the factory is currently enabled for the game.

bool em5::FreeplayEventFactory::isEventAlreadyRunning ( ) const
protected
bool em5::FreeplayEventFactory::operator== ( const FreeplayEventFactory other) const
inline

Compare this factory's unique ID to an other factory's unique ID.

bool em5::FreeplayEventFactory::operator== ( const std::string &  other) const
inline

Compare this factory's name to an std::string.

bool em5::FreeplayEventFactory::operator== ( uint32  other) const
inline

Compare this factory's unique ID to a uint32.

void em5::FreeplayEventFactory::setEventDensity ( float  eventDensity)
inline

Set event desity.

void em5::FreeplayEventFactory::setEventTag ( const std::string &  eventTag)
inline

Set the event tag (used to search the target entity)

void em5::FreeplayEventFactory::setMaxAppearances ( uint32  maxAppearances)
inline

Set limit of appearances

void em5::FreeplayEventFactory::setStartEvent ( bool  startEvent)
inline

Set start event

void em5::FreeplayEventFactory::setTriggerChance ( float  triggerChance)
inline

Set trigger chance for this event factory.

void em5::FreeplayEventFactory::setTriggerFailReason ( const std::string &  reason) const
protected
void em5::FreeplayEventFactory::setVariants ( const VariantArray variants)
inline

Set the variants of the freeplay event factory.

FreeplayEvent* em5::FreeplayEventFactory::tryTriggerEvent ( const FreeplayEventTriggerInfo triggerInfo)

Check if the event preconditions are met and if so, generate an event instance.

Returns
Generated freeplay event if triggering succeeded, or a null pointer otherwise
virtual FreeplayEvent* em5::FreeplayEventFactory::tryTriggerEvent ( )
pure virtual

Implemented in em5::MedicalEmergencyEventFactory, em5::HeatWaveEventFactory, em5::BuildingFireEventFactory, em5::BoatFireEventFactory, em5::TreeAndBushFireEventFactory, em5::MissingPersonEventFactory, em5::MedicalInBuldingEventFactory, em5::DemonstrationEventFactory, em5::DrunkRiotAtBeerTentEventFactory, em5::BuildingNearlyCollapseEventFactory, em5::RiotEventFactory, em5::CityBlackoutEventFactory, em5::HostagesEventFactory, em5::FairBomberEventFactory, em5::HeistEventFactory, em5::RowdyEventFactory, em5::ComplexFireEventFactory, em5::BomberEventFactory, em5::GrandTheftAutoEventFactory, em5::TerrorAttackEventFactory, em5::ManhuntEventFactory, em5::SabotageEventFactory, em5::WeaponDealEventFactory, em5::TrafficAccident01EventFactory, em5::TrainAccidentEventFactory, em5::VehicleFireEventFactory, em5::DirtyBombEventFactory, em5::JailbreakEventFactory, em5::FairVisitorsWithFoodPoisoningEventFactory, em5::EvacuateTrainStationEventFactory, em5::BuildingCollapseEventFactory, em5::GarbageFireEventFactory, em5::PickpocketEventFactory, em5::PillageBuildingEventFactory, em5::RobberyEventFactory, em5::BurningBeerTentEventFactory, em5::PlaneCrashEventFactory, em5::StormDamageEventFactory, em5::DefectEboxEventFactory, em5::CarTheftEventFactory, em5::GangsterTestEventFactory, em5::DrunkenOverboardEventFactory, em5::DummyEventFactory, em5::BuriedPersonEventFactory, em5::Arsonist01EventFactory, em5::Arsonist02EventFactory, em5::RunningAmokEventFactory, em5::BuildingProtectionEventFactory, em5::DemonstrationMobEventFactory, em5::MainEvent104Factory, em5::MainEvent12Factory, em5::MainEvent14Factory, em5::MainEvent15Factory, em5::MainEvent204Factory, em5::MainEvent101Factory, em5::MainEvent203Factory, em5::GenericMainEventFactory, em5::MainEvent06Factory, em5::MainEvent07Factory, em5::MainEvent08Factory, em5::MainEvent10Factory, em5::MainEvent103Factory, em5::MainEvent201Factory, em5::MainEvent100Factory, em5::MainEvent200Factory, em5::MainEvent01Factory, em5::MainEvent02Factory, em5::MainEvent04Factory, em5::MainEvent05Factory, em5::MainEvent102Factory, em5::MainEvent202Factory, em5::ComplexMedicalEmergencyEventFactory, and em5::TutorialFactory.

Friends And Related Function Documentation

friend class FreeplayEventPoolManager
friend

Member Data Documentation

std::string em5::FreeplayEventFactory::mEventTag
protected

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