Emergency 20 Dokumentation  4.2.0
EntityHelper-inl.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Namespace ]
6 //[-------------------------------------------------------]
7 namespace em5
8 {
9 
10 
11  //[-------------------------------------------------------]
12  //[ Public methods ]
13  //[-------------------------------------------------------]
15  qsf::EntityHelper(entity)
16  {
17  // Nothing here
18  }
19 
21  {
22  // Nothing here
23  }
24 
25  template<typename T>
27  {
28  return static_cast<T*>(getGameLogicByTypeId(T::GAMELOGIC_TYPE_ID));
29  }
30 
31 
32  //[-------------------------------------------------------]
33  //[ Misc ]
34  //[-------------------------------------------------------]
35  template<typename T>
36  void EntityHelper::getComponentsFromChildren(std::vector<T*>& output) const
37  {
38  getComponentsFromChildrenById(T::COMPONENT_ID, reinterpret_cast<std::vector<qsf::Component*>&>(output));
39  }
40 
41 
42 //[-------------------------------------------------------]
43 //[ Namespace ]
44 //[-------------------------------------------------------]
45 } // em5
Definition: ActionPriority.h:13
EMERGENCY 5 entity helper class.
Definition: EntityHelper.h:62
Entity class.
Definition: Entity.h:46
qsf::GameLogic * getGameLogicByTypeId(uint32 gameLogicTypeId) const
Return a game logic instance of a certain type.
Definition: PickupPersonByParamedicAction.h:21
~EntityHelper()
Destructor.
Definition: EntityHelper-inl.h:20
EntityHelper(qsf::Entity &entity)
Constructor.
Definition: EntityHelper-inl.h:14
void getComponentsFromChildren(std::vector< T * > &output) const
Return a vector of component instances of a certain type.
Definition: EntityHelper-inl.h:36
T * getGameLogic() const
Return a game logic instance of a certain type.
Definition: EntityHelper-inl.h:26
void getComponentsFromChildrenById(uint32 componentId, std::vector< qsf::Component * > &output) const
Return a vector of component instances of a certain type.