Emergency 20 Dokumentation  4.2.0
BlockAreaWithUnits.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 
15 #include <qsf/base/WeakPtr.h>
16 
17 #include <vector>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25  class Objective;
26 }
27 namespace qsf
28 {
29  class Entity;
30  class Map;
31 }
32 
33 
34 //[-------------------------------------------------------]
35 //[ Namespace ]
36 //[-------------------------------------------------------]
37 namespace em5
38 {
39 
40 
41  //[-------------------------------------------------------]
42  //[ Classes ]
43  //[-------------------------------------------------------]
49  {
50 
51 
52  //[-------------------------------------------------------]
53  //[ Public definitions ]
54  //[-------------------------------------------------------]
55  public:
56  enum class ObjectFilter
57  {
58  ALL_UNITS,
59  BARRIER_TAPES
60  };
61 
62 
63  //[-------------------------------------------------------]
64  //[ Public methods ]
65  //[-------------------------------------------------------]
66  public:
72 
78 
79  uint32 initialize(qsf::Map& map, Objective* objective, uint32 unitsNeededPerArea, const std::string& areasNamingScheme, const std::string& markersNamingScheme, bool switchMarkersWhenBlocked, ObjectFilter objectFilter = ObjectFilter::ALL_UNITS);
80 
81  void setObjective(Objective& objective);
82 
83  bool updateObjective();
84  Objective& getObjectiveSafe();
85 
86  void setMarkersActive(bool active);
87  std::vector<bool> backupActiveMarkers() const;
88  void restoreActiveMarkers(const std::vector<bool>& backup);
89 
90  qsf::Entity* getArea(uint32 index) const;
91 
92 
93  //[-------------------------------------------------------]
94  //[ Private data ]
95  //[-------------------------------------------------------]
96  private:
97  qsf::Map* mMap;
98  Objective* mObjective;
99  uint32 mUnitsNeededPerArea;
100  bool mSwitchMarkersWhenBlocked;
101  ObjectFilter mObjectFilter;
102 
103  struct AreaInfo
104  {
107  bool mMarkerActive;
108  };
109  std::vector<AreaInfo> mAreas;
110 
111 
112  };
113 
114 
115 //[-------------------------------------------------------]
116 //[ Namespace ]
117 //[-------------------------------------------------------]
118 } // em5
Definition: ActionPriority.h:13
Entity class.
Definition: Entity.h:46
Utility class for events when user has to block areas with his units.
Definition: BlockAreaWithUnits.h:48
Map class.
Definition: Map.h:93
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
EMERGENCY 5 objective class.
Definition: Objective.h:51
Definition: PickupPersonByParamedicAction.h:21
ObjectFilter
Definition: BlockAreaWithUnits.h:56