Emergency 20 Dokumentation  4.2.0
RedirectTrafficAction.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 
16 
19 
20 
21 //[-------------------------------------------------------]
22 //[ Namespace ]
23 //[-------------------------------------------------------]
24 namespace em5
25 {
26 
27 
28  //[-------------------------------------------------------]
29  //[ Classes ]
30  //[-------------------------------------------------------]
36  {
37 
38 
39  //[-------------------------------------------------------]
40  //[ Public definitions ]
41  //[-------------------------------------------------------]
42  public:
44 
45 
46  //[-------------------------------------------------------]
47  //[ Public methods ]
48  //[-------------------------------------------------------]
49  public:
55 
60  virtual ~RedirectTrafficAction();
61 
66  void init();
67 
68 
69  //[-------------------------------------------------------]
70  //[ Public virtual qsf::Actions methods ]
71  //[-------------------------------------------------------]
72  public:
73  virtual void serialize(qsf::BinarySerializer& serializer) override;
74 
75 
76  //[-------------------------------------------------------]
77  //[ Protected virtual qsf::Action methods ]
78  //[-------------------------------------------------------]
79  protected:
80  virtual bool onStartup() override;
81  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
82 
83 
84  //[-------------------------------------------------------]
85  //[ Private definitions ]
86  //[-------------------------------------------------------]
87  private:
88  enum State
89  {
90  STATE_INIT,
91  STATE_TURNED,
92  STATE_REDIRECT
93  };
94 
95 
96  //[-------------------------------------------------------]
97  //[ Private data ]
98  //[-------------------------------------------------------]
99  private:
100  State mState;
101  qsf::ai::SpatialConfiguration3D mUnitTarget;
102  uint64 mLastRedirected;
103  bool mHasCheckedRedirectionPath;
104  float mMinimalRedirectionPathLength;
105  qsf::ai::SpatialConfiguration3D mLastRedirectionTarget;
106 
107  // Debug
108  // -> Actually only for internal builds (additional check to find erroneous behavior), but we need to make sure end-user SDK is the same with or without ENDUSER define
109  qsf::DebugDrawProxy mDebugDrawProxy;
110  bool mDebugEnabled;
111 
112 
113  //[-------------------------------------------------------]
114  //[ CAMP reflection system ]
115  //[-------------------------------------------------------]
116  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
117 
118 
119  };
120 
121 
122 //[-------------------------------------------------------]
123 //[ Namespace ]
124 //[-------------------------------------------------------]
125 } // em5
126 
127 
128 //[-------------------------------------------------------]
129 //[ CAMP reflection system ]
130 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Clock class.
Definition: Clock.h:33
static const qsf::NamedIdentifier ACTION_ID
"em5::RedirectTrafficAction" unique action identifier
Definition: RedirectTrafficAction.h:43
#define EM5_API_EXPORT
Definition: Export.h:28
uint64_t uint64
Definition: PlatformTypes.h:184
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
State
Definition: ProcessState.h:20
Debug draw proxy class.
Definition: DebugDrawProxy.h:46
#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
Abstract action base class.
Definition: Action.h:59
EMERGENCY 5 action to redirect traffic.
Definition: RedirectTrafficAction.h:35
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
Binary serializer class.
Definition: BinarySerializer.h:35
Result
Definition: ActionResult.h:20