Emergency 20 Dokumentation  4.2.0
SEKDroneSearchAction.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 
17 
18 //[-------------------------------------------------------]
19 //[ Forward declarations ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23  class DroneTransportLogic;
24  class PersonComponent;
25 }
26 
27 
28 //[-------------------------------------------------------]
29 //[ Namespace ]
30 //[-------------------------------------------------------]
31 namespace em5
32 {
33 
34 
35  //[-------------------------------------------------------]
36  //[ Classes ]
37  //[-------------------------------------------------------]
43  {
44 
45 
46  //[-------------------------------------------------------]
47  //[ Public definitions ]
48  //[-------------------------------------------------------]
49  public:
53 
54  enum State
55  {
60  STATE_DONE
61  };
62 
63 
64  //[-------------------------------------------------------]
65  //[ Public methods ]
66  //[-------------------------------------------------------]
67  public:
73 
78  virtual ~SEKDroneSearchAction();
79 
80  void init(qsf::Entity* droneTransporter);
81 
82  void searchNewTarget();
83 
84 
85  //[-------------------------------------------------------]
86  //[ Public virtual qsf::Actions methods ]
87  //[-------------------------------------------------------]
88  public:
89  virtual void serialize(qsf::BinarySerializer& serializer) override;
90  virtual bool onStartup() override;
91 
92 
93  //[-------------------------------------------------------]
94  //[ Protected virtual qsf::Action methods ]
95  //[-------------------------------------------------------]
96  protected:
97  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
98 
99 
100  //[-------------------------------------------------------]
101  //[ Private methods ]
102  //[-------------------------------------------------------]
103  private:
104  void showHint() const;
105 
106 
107  //[-------------------------------------------------------]
108  //[ Private data ]
109  //[-------------------------------------------------------]
110  private:
111  qsf::Entity* getSearchTarget() const;
112  bool isValidDroneTarget(PersonComponent* personComponent) const;
113  void addListWithPriority(std::multimap<int, qsf::Entity*>& result, std::vector<qsf::Entity*>& list, int priority) const;
114 
115 
116  //[-------------------------------------------------------]
117  //[ Private data ]
118  //[-------------------------------------------------------]
119  private:
120  State mState;
121  qsf::WeakPtr<qsf::Entity> mDroneTransporter;
122  DroneTransportLogic* mDroneTransportLogic;
123  qsf::WeakPtr<qsf::Entity> mSearchTarget;
124  qsf::Time mSecondsPassedSinceClick;
125  qsf::Time mTimeWithoutTarget;
126  bool mNewTarget;
127 
128 
129  //[-------------------------------------------------------]
130  //[ CAMP reflection system ]
131  //[-------------------------------------------------------]
132  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
133 
134 
135  };
136 
137 
138 //[-------------------------------------------------------]
139 //[ Namespace ]
140 //[-------------------------------------------------------]
141 } // em5
142 
143 
144 //[-------------------------------------------------------]
145 //[ CAMP reflection system ]
146 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 person component class.
Definition: PersonComponent.h:48
Definition: SEKDroneSearchAction.h:58
Entity class.
Definition: Entity.h:46
State
Definition: SEKDroneSearchAction.h:54
Clock class.
Definition: Clock.h:33
EMERGENCY 5 SEK drone search action.
Definition: SEKDroneSearchAction.h:42
#define EM5_API_EXPORT
Definition: Export.h:28
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
EMERGENCY 5 drone transport logic.
Definition: DroneTransportLogic.h:42
State
Definition: ProcessState.h:20
Definition: SEKDroneSearchAction.h:56
#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
Definition: SEKDroneSearchAction.h:59
Definition: SEKDroneSearchAction.h:57
static const qsf::NamedIdentifier ACTION_ID
"em5::SEKDroneSearchAction" unique action identifier
Definition: SEKDroneSearchAction.h:50
Abstract action base class.
Definition: Action.h:59
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
static const qsf::Time TIME_DRONE_FLY_WITHOUT_TARGET
Time the drone is searching for new targets till go back to transporter.
Definition: SEKDroneSearchAction.h:52
Binary serializer class.
Definition: BinarySerializer.h:35
static const qsf::Time TIME_BETWEEN_CLICKS
Time between click sound effect.
Definition: SEKDroneSearchAction.h:51
Result
Definition: ActionResult.h:20
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32