Emergency 20 Dokumentation  4.2.0
BoatFireEvent.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 
17 
18 
19 //[-------------------------------------------------------]
20 //[ Forward declarations ]
21 //[-------------------------------------------------------]
22 namespace qsf
23 {
24  class Layer;
25 }
26 
27 
28 //[-------------------------------------------------------]
29 //[ Namespace ]
30 //[-------------------------------------------------------]
31 namespace em5
32 {
33 
34 
35  //[-------------------------------------------------------]
36  //[ Classes ]
37  //[-------------------------------------------------------]
43  {
44 
45 
46  //[-------------------------------------------------------]
47  //[ Friends ]
48  //[-------------------------------------------------------]
49  friend class BoatFireEventFactory;
50 
51 
52  //[-------------------------------------------------------]
53  //[ Public definitions ]
54  //[-------------------------------------------------------]
55  public:
56  static const uint32 FREEPLAY_EVENT_ID;
57 
58  typedef std::vector<qsf::Entity*> EntityArray;
59 
60 
61  //[-------------------------------------------------------]
62  //[ Public static methods ]
63  //[-------------------------------------------------------]
64  public:
65  static bool canSpawnEntitiesCollisionFree(const qsf::Layer& layer, qsf::Map& map);
66 
67 
68  //[-------------------------------------------------------]
69  //[ Public methods ]
70  //[-------------------------------------------------------]
71  public:
76  BoatFireEvent();
77 
82  virtual ~BoatFireEvent();
83 
84  void initWithLayer(qsf::Layer* layer);
85 
90  uint64 getTargetEntityId() const;
91 
96  void setTargetEntity(const qsf::Entity& entity);
97 
98  void setBurnShipAtStartup(bool burnShipAtStartup);
99 
100  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(PersonsInWater, uint32, mPersonsInWater);
101  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(PersonsOnDeck, uint32, mPersonsOnDeck);
102 
103 
104  //[-------------------------------------------------------]
105  //[ Public virtual em5::FreeplayEvent methods ]
106  //[-------------------------------------------------------]
107  public:
108  virtual bool onStartup() override;
109  virtual void onShutdown() override;
110  virtual void onRun() override;
111  virtual bool onFailure(EventResult& eventResult) override;
112  virtual void updateFreeplayEvent(const qsf::Time& timePassed) override;
113  virtual bool addEntityToEvent(qsf::Entity& targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override;
114  virtual const qsf::Entity* getFocusEntity() override;
115  virtual bool checkEventConfiguration() override;
116  virtual void serialize(qsf::BinarySerializer& serializer) override;
117  virtual void hintCallback(Observer& hintObserver) override;
118 
119 
120  //[-------------------------------------------------------]
121  //[ Private methods ]
122  //[-------------------------------------------------------]
123  private:
124  void startObjectives(const qsf::Entity& targetEntity);
125  void startHintObservers(const qsf::Entity& targetEntity);
126  void onPersonRescued(const qsf::MessageParameters& parameters);
127  void onBoatDestroyed(const qsf::MessageParameters& parameters);
128 
129  bool startupFromLayer(qsf::Layer& eventLayer);
130  void findSpawnPoints();
131  void spawnPersonsForRescue();
132 
133 
134  //[-------------------------------------------------------]
135  //[ Private data ]
136  //[-------------------------------------------------------]
137  private:
138  uint64 mTargetEntityId;
139  uint32 mPersonsInWater;
140  uint32 mPersonsOnDeck;
141  EntityArray mSpawnPointsInWater;
142  EntityArray mSpawnPointsOnDeck;
143  uint32 mEventLayerId;
144  bool mBurnShipAtStartup;
145 
146  // Intern
147  qsf::MessageProxy mPersonRescueByHeliMessageProxy;
148  qsf::MessageProxy mPersonRescueByDiverMessageProxy;
149  qsf::MessageProxy mBoatDestroyedMessageProxy;
150 
151 
152  //[-------------------------------------------------------]
153  //[ CAMP reflection system ]
154  //[-------------------------------------------------------]
155  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
156 
157 
158  };
159 
160 
161 //[-------------------------------------------------------]
162 //[ Namespace ]
163 //[-------------------------------------------------------]
164 } // em5
165 
166 
167 //[-------------------------------------------------------]
168 //[ CAMP reflection system ]
169 //[-------------------------------------------------------]
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
Map class.
Definition: Map.h:93
Layer class.
Definition: Layer.h:56
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Message listener proxy class.
Definition: MessageProxy.h:47
Reason
Definition: EventSpreadReason.h:20
uint64_t uint64
Definition: PlatformTypes.h:184
std::vector< qsf::Entity * > EntityArray
Definition: BoatFireEvent.h:58
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
Definition: PickupPersonByParamedicAction.h:21
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
EMERGENCY 5 freeplay event factory for "boat fire event".
Definition: BoatFireEventFactory.h:47
#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
static const uint32 FREEPLAY_EVENT_ID
"em5::BoatFireEvent" unique freeplay event ID
Definition: BoatFireEvent.h:56
Abstract EMERGENCY 5 freeplay event base class.
Definition: FreeplayEvent.h:66
EMERGENCY 5 freeplay event "boat fire".
Definition: BoatFireEvent.h:42
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