Emergency 20 Dokumentation  4.2.0
MapHelper-inl.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Includes ]
6 //[-------------------------------------------------------]
7 #include <qsf/map/Entity.h>
8 #include <qsf/map/Map.h>
9 
10 
11 //[-------------------------------------------------------]
12 //[ Namespace ]
13 //[-------------------------------------------------------]
14 namespace em5
15 {
16 
17 
18  //[-------------------------------------------------------]
19  //[ Public methods ]
20  //[-------------------------------------------------------]
22  qsf::MapHelper(map)
23  {
24  // Nothing here
25  }
26 
28  {
29  // Nothing here
30  }
31 
32  template <typename T>
33  void MapHelper::showComponentofEntityIds(std::vector<uint64>& entityIds, bool show) const
34  {
35  for (uint64 entityId : entityIds)
36  {
37  // Get the entity
38  const qsf::Entity* entity = getMap().getEntityById(entityId);
39  if (nullptr != entity)
40  {
41  // Update the component
42  T* component = entity->getComponent<T>();
43  if (nullptr != component)
44  {
45  component->setActive(show);
46  }
47  }
48  }
49  }
50 
51 
52 //[-------------------------------------------------------]
53 //[ Namespace ]
54 //[-------------------------------------------------------]
55 } // em5
Definition: ActionPriority.h:13
MapHelper(qsf::Map &map)
Constructor.
Definition: MapHelper-inl.h:21
Entity class.
Definition: Entity.h:46
Map class.
Definition: Map.h:93
uint64_t uint64
Definition: PlatformTypes.h:184
Definition: PickupPersonByParamedicAction.h:21
EMERGENCY 5 map helper class.
Definition: MapHelper.h:57
~MapHelper()
Destructor.
Definition: MapHelper-inl.h:27
Entity * getEntityById(uint64 id) const
Return an entity instance by using its unique identifier.
Definition: Map-inl.h:81
void showComponentofEntityIds(std::vector< uint64 > &entityIds, bool show) const
Definition: MapHelper-inl.h:33
Map & getMap() const
Return the map instance the map helper operates on.
Definition: MapHelper-inl.h:25
T * getComponent() const
Return a component instance of a certain type.
Definition: Prototype-inl.h:63