Emergency 20 Dokumentation  4.2.0
CleanupManager.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 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 
17 
18 
19 //[-------------------------------------------------------]
20 //[ Forward declarations ]
21 //[-------------------------------------------------------]
22 namespace em5
23 {
24  class Cleanup;
25 }
26 namespace qsf
27 {
28  class GameLogicComponent;
29  class Entity;
30  class Map;
31  class TransformComponent;
32 }
33 
34 
35 //[-------------------------------------------------------]
36 //[ Namespace ]
37 //[-------------------------------------------------------]
38 namespace em5
39 {
40 
41 
42  //[-------------------------------------------------------]
43  //[ Classes ]
44  //[-------------------------------------------------------]
53  {
54 
55 
56  //[-------------------------------------------------------]
57  //[ Friends ]
58  //[-------------------------------------------------------]
59  friend class Cleanup; // May register and unregister itself
60 
61 
62  //[-------------------------------------------------------]
63  //[ Public definitions ]
64  //[-------------------------------------------------------]
65  public:
66  typedef std::vector<Cleanup*> CleanupArray;
67  typedef std::pair<qsf::TransformComponent*, bool> BoxInformation;
68 
69 
70  //[-------------------------------------------------------]
71  //[ Public methods ]
72  //[-------------------------------------------------------]
73  public:
79 
84  virtual ~CleanupManager();
85 
90  void cleanupCompleteMap();
91 
96  void startup();
97 
102  void shutdown();
103 
108  void setCleanupUpdatesActive(bool active);
109 
117  void removeAllCivilians();
118 
123  void removeAllGangster();
124 
129  void removeAllBarrierTapes();
130 
131  void cleanupFreeplayEntities(std::vector<qsf::Entity*>& cleanupEntities);
132 
133 
134  //[-------------------------------------------------------]
135  //[ Private methods ]
136  //[-------------------------------------------------------]
137  private:
142  void onGetsDamaged(const qsf::MessageParameters& parameters);
143 
148  void onStartBurning(const qsf::MessageParameters& parameters);
149 
154  void onStartContamination(const qsf::MessageParameters& parameters);
155 
163  bool createCleanupObserver(uint64 messageId, qsf::GameLogicComponent& gameLogicComponent);
164 
169  void registerCleanupObserver(Cleanup& cleanup);
170 
175  void unregisterCleanupObserver(Cleanup& cleanup);
176 
181  void cleanupAllUnits() const;
182 
187  void cleanupAllBuoyes() const;
188 
193  void cleanupAllFireComponents();
194 
199  void cleanupAllUsables();
200 
213  bool isPositionInsideAnyBoxes(const glm::vec3& pointPosition, const std::vector<BoxInformation> &boxInformations) const;
214 
229  bool isPointInsideBox(const glm::vec3& pointPosition, const qsf::TransformComponent& boxTransform, bool yAxisCentered) const;
230 
231 
232  //[-------------------------------------------------------]
233  //[ Private data ]
234  //[-------------------------------------------------------]
235  private:
236  qsf::MessageProxy mMessageProxyPerson;
237  qsf::MessageProxy mMessageProxyContaminatedPerson;
238  qsf::MessageProxy mMessageProxyVehicle;
239  qsf::MessageProxy mMessageProxyBuilding;
240  qsf::MessageProxy mMessageProxyVegetation;
241  qsf::MessageProxy mMessageProxyFire;
242  qsf::MessageProxy mMessageProxyContaminationCloud;
243 
244  CleanupArray mCleanupObservers;
245 
246 
247  };
248 
249 
250 //[-------------------------------------------------------]
251 //[ Namespace ]
252 //[-------------------------------------------------------]
253 } // em5
Definition: ActionPriority.h:13
Message parameters class.
Definition: MessageParameters.h:34
Transform component class.
Definition: TransformComponent.h:33
#define EM5_API_EXPORT
Definition: Export.h:28
std::vector< Cleanup * > CleanupArray
Definition: CleanupManager.h:66
Game logic component class.
Definition: GameLogicComponent.h:45
Message listener proxy class.
Definition: MessageProxy.h:47
uint64_t uint64
Definition: PlatformTypes.h:184
Manager for cleanups.
Definition: CleanupManager.h:52
Abstract manager interface.
Definition: Manager.h:40
Definition: PickupPersonByParamedicAction.h:21
std::pair< qsf::TransformComponent *, bool > BoxInformation
Definition: CleanupManager.h:67
Cleanup base class.
Definition: Cleanup.h:37