Emergency 20 Dokumentation  4.2.0
FreeplayEventFactory-inl.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Includes ]
6 //[-------------------------------------------------------]
8 
9 
10 //[-------------------------------------------------------]
11 //[ Namespace ]
12 //[-------------------------------------------------------]
13 namespace em5
14 {
15 
16 
17  //[-------------------------------------------------------]
18  //[ Public methods ]
19  //[-------------------------------------------------------]
21  {
22  return mName.getHash();
23  }
24 
25  inline const std::string& FreeplayEventFactory::getEventName() const
26  {
27  return mName.getName();
28  }
29 
30  inline bool FreeplayEventFactory::isEnabled() const
31  {
32  return mIsEnabled;
33  }
34 
36  {
37  return mTriggerChance;
38  }
39 
40  inline void FreeplayEventFactory::setTriggerChance(float triggerChance)
41  {
42  mTriggerChance = triggerChance;
43  }
44 
46  {
47  return mEventDensity;
48  }
49 
50  inline void FreeplayEventFactory::setEventDensity(float eventDensity)
51  {
52  mEventDensity = eventDensity;
53  }
54 
56  {
57  return mStartEvent;
58  }
59 
60  inline void FreeplayEventFactory::setStartEvent(bool startEvent)
61  {
62  mStartEvent = startEvent;
63  }
64 
66  {
67  return mMaxAppearances;
68  }
69 
70  inline void FreeplayEventFactory::setMaxAppearances(uint32 maxAppearances)
71  {
72  mMaxAppearances = maxAppearances;
73  }
74 
75  inline const std::string& FreeplayEventFactory::getEventTag() const
76  {
77  return mEventTag;
78  }
79 
80  inline void FreeplayEventFactory::setEventTag(const std::string& eventTag)
81  {
82  mEventTag = eventTag;
83  }
84 
86  {
87  return mVariants;
88  }
89 
90  inline void FreeplayEventFactory::setVariants(const VariantArray& variants)
91  {
92  mVariants = variants;
93  }
94 
96  {
97  return (getId() == other.getId());
98  }
99 
100  inline bool FreeplayEventFactory::operator ==(const std::string& other) const
101  {
102  return (getEventName() == other);
103  }
104 
105  inline bool FreeplayEventFactory::operator ==(uint32 other) const
106  {
107  return (getId() == other);
108  }
109 
110 
111  //[-------------------------------------------------------]
112  //[ Protected methods ]
113  //[-------------------------------------------------------]
114  template<typename T>
116  {
117  // Create a new instance of the given type
118  T* eventInstance = new T();
119 
120  // Initialize and done
121  initializeEventInstance(*eventInstance);
122  return *eventInstance;
123  }
124 
125 
126 //[-------------------------------------------------------]
127 //[ Namespace ]
128 //[-------------------------------------------------------]
129 } // em5
Definition: ActionPriority.h:13
void setVariants(const VariantArray &variants)
Set the variants of the freeplay event factory.
Definition: FreeplayEventFactory-inl.h:90
void setEventDensity(float eventDensity)
Set event desity.
Definition: FreeplayEventFactory-inl.h:50
const std::string & getEventTag() const
Get the event tag (used to search the target entity)
Definition: FreeplayEventFactory-inl.h:75
unsigned int uint32
Definition: PlatformTypes.h:181
void setMaxAppearances(uint32 maxAppearances)
Definition: FreeplayEventFactory-inl.h:70
uint32 getMaxAppearances() const
Get limit of appearances.
Definition: FreeplayEventFactory-inl.h:65
bool operator==(const FreeplayEventFactory &other) const
Compare this factory's unique ID to an other factory's unique ID.
Definition: FreeplayEventFactory-inl.h:95
const VariantArray & getVariants() const
Get the variants of the freeplay event factory.
Definition: FreeplayEventFactory-inl.h:85
T & createAndInitializeEvent()
Definition: FreeplayEventFactory-inl.h:115
void setStartEvent(bool startEvent)
Definition: FreeplayEventFactory-inl.h:60
std::vector< boost::property_tree::ptree > VariantArray
Definition: FreeplayEventFactory.h:70
bool getStartEvent() const
Get start event.
Definition: FreeplayEventFactory-inl.h:55
const std::string & getEventName() const
Return event's name.
Definition: FreeplayEventFactory-inl.h:25
EMERGENCY 5 freeplay event factory base class.
Definition: FreeplayEventFactory.h:56
void setTriggerChance(float triggerChance)
Set trigger chance for this event factory.
Definition: FreeplayEventFactory-inl.h:40
uint32 getId() const
Return event factory's unique ID.
Definition: FreeplayEventFactory-inl.h:20
float getEventDensity() const
Get event density.
Definition: FreeplayEventFactory-inl.h:45
bool isEnabled() const
Return whether or not the factory is currently enabled for the game.
Definition: FreeplayEventFactory-inl.h:30
void setEventTag(const std::string &eventTag)
Set the event tag (used to search the target entity)
Definition: FreeplayEventFactory-inl.h:80
const std::string & getName() const
Return the name string.
Definition: NamedIdentifier-inl.h:51
uint32 getHash() const
Return the generated hash value.
Definition: NamedIdentifier-inl.h:56
float getTriggerChance() const
Return trigger chance for this event factory.
Definition: FreeplayEventFactory-inl.h:35
std::string mEventTag
Definition: FreeplayEventFactory.h:282