Emergency 20 Dokumentation  4.2.0
TrappedPersonFleeAction.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 #include <qsf/time/Time.h>
15 #include <qsf/job/JobProxy.h>
16 
17 
18 //[-------------------------------------------------------]
19 //[ Forward declarations ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23  class BuildingComponent;
24 }
25 
26 
27 //[-------------------------------------------------------]
28 //[ Namespace ]
29 //[-------------------------------------------------------]
30 namespace em5
31 {
32 
33 
34  //[-------------------------------------------------------]
35  //[ Classes ]
36  //[-------------------------------------------------------]
45  {
46 
47 
48  //[-------------------------------------------------------]
49  //[ Public definitions ]
50  //[-------------------------------------------------------]
51  public:
53 
54 
55  //[-------------------------------------------------------]
56  //[ Public methods ]
57  //[-------------------------------------------------------]
58  public:
64 
65  void init(const qsf::Time& runningTime, BuildingComponent& buildingComponent);
66 
67 
68  //[-------------------------------------------------------]
69  //[ Public virtual qsf::Actions methods ]
70  //[-------------------------------------------------------]
71  public:
72  virtual void serialize(qsf::BinarySerializer& serializer) override {} // Not implemented yet
73 
74 
75  //[-------------------------------------------------------]
76  //[ Protected virtual qsf::Action methods ]
77  //[-------------------------------------------------------]
78  protected:
79  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
80  virtual bool onStartup() override;
81  virtual void onShutdown() override;
82 
83 
84  //[-------------------------------------------------------]
85  //[ Private methods ]
86  //[-------------------------------------------------------]
87  private:
88  void updateSimulation(const qsf::JobArguments& jobArguments);
89 
90 
91  //[-------------------------------------------------------]
92  //[ Private data ]
93  //[-------------------------------------------------------]
94  private:
95  // Configuration
96  qsf::Time mRunningTime;
97  qsf::WeakPtr<qsf::Entity> mEntityToFleeFrom;
98 
99  // Backup of values
100  bool mWasSelectable;
101  std::string mImmunitiesBackup;
102 
103  qsf::JobProxy mUpdateJobProxy;
104 
105 
106  //[-------------------------------------------------------]
107  //[ CAMP reflection system ]
108  //[-------------------------------------------------------]
109  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
110 
111 
112  };
113 
114 
115 //[-------------------------------------------------------]
116 //[ Namespace ]
117 //[-------------------------------------------------------]
118 } // em5
119 
120 
121 //[-------------------------------------------------------]
122 //[ CAMP reflection system ]
123 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
EMERGENCY 5 building component class.
Definition: BuildingComponent.h:56
Trapped person flee action.
Definition: TrappedPersonFleeAction.h:44
Clock class.
Definition: Clock.h:33
virtual void onShutdown() override
Called before the action gets removed, in case it was active at least once since its creation...
virtual qsf::action::Result updateAction(const qsf::Clock &clock) override
Update the action.
virtual void serialize(qsf::BinarySerializer &serializer) override
Serialize or deserialize the action using a binary serializer.
Definition: TrappedPersonFleeAction.h:72
void init(const qsf::Time &runningTime, BuildingComponent &buildingComponent)
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
static const qsf::NamedIdentifier ACTION_ID
"em5::TrappedPersonFleeAction" unique action identifier
Definition: TrappedPersonFleeAction.h:52
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Abstract action base class.
Definition: Action.h:59
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
virtual bool onStartup() override
Called when the action gets active (i.e. switches to the "running" state) for the first time...
Binary serializer class.
Definition: BinarySerializer.h:35
Result
Definition: ActionResult.h:20
TrappedPersonFleeAction()
Default constructor.
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32