Emergency 20 Dokumentation  4.2.0
EntityLogicHelper.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 
16 //[-------------------------------------------------------]
17 //[ Forward declarations ]
18 //[-------------------------------------------------------]
19 namespace qsf
20 {
21  class Entity;
22  namespace game
23  {
24  class Command;
25  }
26 }
27 namespace em5
28 {
29  class CommandContext;
30 }
31 
32 
33 //[-------------------------------------------------------]
34 //[ Namespace ]
35 //[-------------------------------------------------------]
36 namespace em5
37 {
38 
39 
40  //[-------------------------------------------------------]
41  //[ Classes ]
42  //[-------------------------------------------------------]
48  {
49 
50 
51  //[-------------------------------------------------------]
52  //[ Public methods ]
53  //[-------------------------------------------------------]
54  public:
65  template<typename T>
66  static bool checkAndExecuteAutomatism(qsf::Entity* caller, qsf::Entity* target, const boost::optional<glm::vec3> hitPosition = boost::optional<glm::vec3>());
67 
68 
69  //[-------------------------------------------------------]
70  //[ Private methods ]
71  //[-------------------------------------------------------]
72  private:
73  EntityLogicHelper() {};
74  ~EntityLogicHelper() {};
75 
76  static bool internalCheckAndExecuteAutomatism(uint32 commandId, qsf::Entity* caller, qsf::Entity* target, const boost::optional<glm::vec3> hitPosition);
77  static void buildCommandContext(CommandContext& outCommandContext, qsf::Entity* caller, qsf::Entity* target, const boost::optional<glm::vec3> hitPosition);
78 
79 
80  };
81 
82 
83  // TODO(fw): Move implementation to an -inl.h file
84  template<typename T>
85  bool EntityLogicHelper::checkAndExecuteAutomatism(qsf::Entity* caller, qsf::Entity* target, const boost::optional<glm::vec3> hitPosition)
86  {
87  return internalCheckAndExecuteAutomatism(T::PLUGINABLE_ID, caller, target, hitPosition);
88  }
89 
90 
91 //[-------------------------------------------------------]
92 //[ Namespace ]
93 //[-------------------------------------------------------]
94 } // em5
Definition: ActionPriority.h:13
Entity class.
Definition: Entity.h:46
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: PickupPersonByParamedicAction.h:21
EMERGENCY 5 command context class.
Definition: CommandContext.h:41
static bool checkAndExecuteAutomatism(qsf::Entity *caller, qsf::Entity *target, const boost::optional< glm::vec3 > hitPosition=boost::optional< glm::vec3 >())
Check if the given command is able to execute for the caller.
Definition: EntityLogicHelper.h:85
Static entity logic helper class.
Definition: EntityLogicHelper.h:47