Emergency 20 Dokumentation  4.2.0
MedicalEmergencyEvent.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
14 
16 #include <qsf/time/Time.h>
17 
18 
19 //[-------------------------------------------------------]
20 //[ Namespace ]
21 //[-------------------------------------------------------]
22 namespace em5
23 {
24 
25 
26  //[-------------------------------------------------------]
27  //[ Classes ]
28  //[-------------------------------------------------------]
34  {
35 
36 
37  //[-------------------------------------------------------]
38  //[ Public definitions ]
39  //[-------------------------------------------------------]
40  public:
41  static const uint32 FREEPLAY_EVENT_ID;
42 
43 
44  //[-------------------------------------------------------]
45  //[ Public methods ]
46  //[-------------------------------------------------------]
47  public:
53 
58  virtual ~MedicalEmergencyEvent();
59 
64  uint64 getTargetPersonId() const;
65 
70  void setTargetPerson(const qsf::Entity& entity);
71 
76  const std::string& getInjuryName() const;
77 
82  void setInjuryName(const std::string& injuryName);
83 
88  float getRunningDelay() const;
89 
94  void setRunningDelay(float runningDelay);
95 
100  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(EventLayer, const std::string&, mEventLayer);
101  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(RescueWithHelicopter, bool, mRescueWithHelicopter);
102  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(SpawnPointEntityId, uint64, mSpawnPointEntityId); // TODO(fw): Not referenced anywhere (yet)?
103  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(SecondEventTag, const std::string&, mSecondEventTag);
104 
105 
106  //[-------------------------------------------------------]
107  //[ Public virtual em5::FreeplayEvent methods ]
108  //[-------------------------------------------------------]
109  public:
110  virtual bool onStartup() override;
111  virtual void onShutdown() override;
112  virtual void onRun() override;
113  virtual bool onFailure(EventResult& eventResult) override;
114  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
115  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
116  virtual void hintCallback(Observer& hintObserver) override;
117  virtual const qsf::Entity* getFocusEntity() override;
118  virtual bool checkEventConfiguration() override;
119  virtual void serialize(qsf::BinarySerializer& serializer) override;
120 
121 
122  //[-------------------------------------------------------]
123  //[ Private methods ]
124  //[-------------------------------------------------------]
125  private:
126  void startObjectives(const qsf::Entity& targetEntity);
127  void startHintObservers(const qsf::Entity& targetEntity);
128 
133  bool checkCandidate(qsf::Entity* targetEntity);
134 
139  void delayedStartup(const qsf::MessageParameters& parameters);
140 
141  void activateLayer(const std::string& layerName);
142  void deactivateLayer(const std::string& layerName);
143 
144 
145  //[-------------------------------------------------------]
146  //[ Private data ]
147  //[-------------------------------------------------------]
148  private:
149  // Configuration
150  uint64 mInjuredEntityId;
151  uint64 mSpawnPointEntityId;
152  qsf::NamedIdentifier mInjuryName;
153  qsf::Time mRunningDelay;
154  std::string mHintLowLifeEnergyName;
155  std::string mHintLowHealthEnergyName;
156  std::string mEventLayer;
157  bool mRescueWithHelicopter;
158  std::string mSecondEventTag;
159 
160  // Internal
161  qsf::MessageProxy mMessageProxy;
162 
163 
164  //[-------------------------------------------------------]
165  //[ CAMP reflection system ]
166  //[-------------------------------------------------------]
167  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
168 
169 
170  };
171 
172 
173 //[-------------------------------------------------------]
174 //[ Namespace ]
175 //[-------------------------------------------------------]
176 } // em5
177 
178 
179 //[-------------------------------------------------------]
180 //[ CAMP reflection system ]
181 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: FreeplayEvent.h:110
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
static const uint32 FREEPLAY_EVENT_ID
"em5::MedicalEmergencyEvent" unique freeplay event ID
Definition: MedicalEmergencyEvent.h:41
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
uint64_t uint64
Definition: PlatformTypes.h:184
EMERGENCY 5 freeplay event "medical emergency".
Definition: MedicalEmergencyEvent.h:33
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
#define QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(name, type, variable)
Definition: PropertyHelper.h:16
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
Abstract EMERGENCY 5 freeplay event base class.
Definition: FreeplayEvent.h:66
Binary serializer class.
Definition: BinarySerializer.h:35
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32