Emergency 20 Dokumentation  4.2.0
UnitSpawnPointComponent.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 
15 
16 //[-------------------------------------------------------]
17 //[ Namespace ]
18 //[-------------------------------------------------------]
19 namespace em5
20 {
21 
22 
23  //[-------------------------------------------------------]
24  //[ Classes ]
25  //[-------------------------------------------------------]
34  {
35 
36 
37  //[-------------------------------------------------------]
38  //[ Public definitions ]
39  //[-------------------------------------------------------]
40  public:
41  static const uint32 COMPONENT_ID;
42 
44  {
46  UNITSPAWNPOINTTYPE_EXIT
47  };
48 
49 
50  //[-------------------------------------------------------]
51  //[ Public static methods ]
52  //[-------------------------------------------------------]
53  public:
54  static UnitSpawnPointComponent* findUnitSpawnPoint(const qsf::StringHash& unitTypeId, UnitSpawnPointType unitSpawnPointType, const qsf::Map& map, const glm::vec3& targetPosition);
55 
56 
57  //[-------------------------------------------------------]
58  //[ Public methods ]
59  //[-------------------------------------------------------]
60  public:
68  inline explicit UnitSpawnPointComponent(qsf::Prototype* prototype);
69 
74  inline virtual ~UnitSpawnPointComponent();
75 
76  inline UnitSpawnPointType getUnitSpawnPointType() const;
77  inline void setUnitSpawnPointType(UnitSpawnPointType unitSpawnPointType);
78 
79  inline const std::vector<std::string>& getUnitList() const;
80  inline void setUnitList(const std::vector<std::string>& unitNames);
81 
82 
83  //[-------------------------------------------------------]
84  //[ Public virtual qsf::Component methods ]
85  //[-------------------------------------------------------]
86  public:
87  virtual void serialize(qsf::BinarySerializer& serializer) override;
88 
89 
90  //[-------------------------------------------------------]
91  //[ Public virtual em5::SpawnPointComponent methods ]
92  //[-------------------------------------------------------]
93  public:
94  inline virtual bool isEntry() const override;
95  inline virtual bool isExit() const override;
96 
97 
98  //[-------------------------------------------------------]
99  //[ Protected virtual qsf::Component methods ]
100  //[-------------------------------------------------------]
101  protected:
102  virtual void onSetSimulating(bool simulating) override;
103 
104 
105  //[-------------------------------------------------------]
106  //[ Private definitions ]
107  //[-------------------------------------------------------]
108  private:
109  enum MatchType
110  {
111  MATCH_NONE = 0,
112  MATCH_WILDCARD_1,
113  MATCH_WILDCARD_2,
114  MATCH_WILDCARD_3,
115  MATCH_EXACT,
116  };
117  typedef boost::container::flat_map<uint32, MatchType> UnitIdMatchMap;
118 
119 
120  //[-------------------------------------------------------]
121  //[ Private methods ]
122  //[-------------------------------------------------------]
123  private:
124  MatchType matchesUnitTypeId(uint32 unitTypeId) const;
125 
126 
127  //[-------------------------------------------------------]
128  //[ Private data ]
129  //[-------------------------------------------------------]
130  private:
131  UnitSpawnPointType mSpawnPointType;
132  UnitIdMatchMap mMatchingUnitIds;
133 
134 
135  //[-------------------------------------------------------]
136  //[ CAMP reflection system ]
137  //[-------------------------------------------------------]
138  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
139  QSF_CAMP_ARRAY_PROPERTY(UnitList, UnitSpawnPointComponent, std::string)
140 
141 
142  };
143 
144 
145 //[-------------------------------------------------------]
146 //[ Namespace ]
147 //[-------------------------------------------------------]
148 } // em5
149 
150 
151 //[-------------------------------------------------------]
152 //[ Implementation ]
153 //[-------------------------------------------------------]
154 #include "em5/component/spawnpoint/UnitSpawnPointComponent-inl.h"
155 
156 
157 //[-------------------------------------------------------]
158 //[ CAMP reflection system ]
159 //[-------------------------------------------------------]
161 QSF_CAMP_TYPE_NONCOPYABLE(em5::UnitSpawnPointComponent::UnitSpawnPointType)
162 QSF_CAMP_ARRAY_MAPPER_DEFINITION(em5::UnitSpawnPointComponent::UnitListInterface)
Definition: ActionPriority.h:13
UnitSpawnPointType
Definition: UnitSpawnPointComponent.h:43
Map class.
Definition: Map.h:93
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: AreaConfiguration.h:58
Definition: UnitSpawnPointComponent.h:45
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
QSF_CAMP_ARRAY_MAPPER_DEFINITION(qsf::ai::TrafficLightTimerComponent::ManagedTrafficLightList)
#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
EMERGENCY 5 entities can spawn from this point. It has a list of valid entities which can spawn from ...
Definition: SpawnPointComponent.h:49
#define QSF_CAMP_ARRAY_PROPERTY(propertyName, ownerType, elementType)
Definition: CampClass.h:262
static const uint32 COMPONENT_ID
"em5::UnitSpawnPointComponent" unique component ID
Definition: UnitSpawnPointComponent.h:41
EMERGENCY 5 spawn point component.
Definition: UnitSpawnPointComponent.h:33
Prototype class.
Definition: Prototype.h:100
Compile time string hash class.
Definition: StringHash.h:59
Binary serializer class.
Definition: BinarySerializer.h:35