Emergency 20 Dokumentation  4.2.0
PersonInBuildingLogic.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/audio/AudioProxy.h"
15 #include "em5/Export.h"
16 
20 
21 
22 //[-------------------------------------------------------]
23 //[ Namespace ]
24 //[-------------------------------------------------------]
25 namespace em5
26 {
27 
28 
29  //[-------------------------------------------------------]
30  //[ Classes ]
31  //[-------------------------------------------------------]
37  {
38 
39 
40  //[-------------------------------------------------------]
41  //[ Public definitions ]
42  //[-------------------------------------------------------]
43  public:
44  static const uint32 GAMELOGIC_TYPE_ID; // "em5::PersonInBuildingLogic" game logic type ID
45 
46 
47  //[-------------------------------------------------------]
48  //[ Public methods ]
49  //[-------------------------------------------------------]
50  public:
56 
57  void clearAllowedUnits();
58  void addAllowedUnit(const qsf::StringHash& unitType);
59 
60  bool isTeamComplete() const;
61  bool isUnitAllowed(const qsf::Entity& entity);
62 
63  void startFreeingCivil();
64  bool isBuildingEmpty();
65 
66  void playEvacuateAudio();
67 
68  QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(NumberValidTeamUnitsNeeded, int, mNumberValidTeamUnitsNeeded);
69 
70 
71  //[-------------------------------------------------------]
72  //[ Public virtual qsf::GameLogic methods ]
73  //[-------------------------------------------------------]
74  public:
75  virtual bool onStartup() override;
76  virtual void onShutdown() override;
77 
78 
79  //[-------------------------------------------------------]
80  //[ Private methods ]
81  //[-------------------------------------------------------]
82  private:
83  void updateSimulation(const qsf::JobArguments& jobArguments);
84 
85 
86  //[-------------------------------------------------------]
87  //[ Private data ]
88  //[-------------------------------------------------------]
89  private:
90  qsf::WeakPtr<BuildingComponent> mBuildingComponent;
91  int mNumberValidTeamUnitsNeeded;
92  qsf::JobProxy mUpdateJobProxy;
93 
94  bool mIsJobActive;
95  qsf::Time mRescuePersonTimer;
96  qsf::Time mRescuePersonTimerMax;
97 
98  AudioProxy mAudioProxy;
99 
100  boost::container::flat_set<qsf::StringHash> mAllowedUnits;
101 
102 
103  //[-------------------------------------------------------]
104  //[ CAMP reflection system ]
105  //[-------------------------------------------------------]
106  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
107 
108 
109  };
110 
111 
112 //[-------------------------------------------------------]
113 //[ Namespace ]
114 //[-------------------------------------------------------]
115 } // em5
116 
117 
118 //[-------------------------------------------------------]
119 //[ CAMP reflection system ]
120 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
Entity class.
Definition: Entity.h:46
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Lightweight weak pointer implementation.
Definition: WeakPtr.h:133
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
Extended audio proxy for easier multiplay usage.
Definition: AudioProxy.h:47
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
static const uint32 GAMELOGIC_TYPE_ID
Definition: PersonInBuildingLogic.h:44
Game logic base class.
Definition: GameLogic.h:44
#define QSF_DEFINE_SIMPLE_GETTER_AND_SETTER(name, type, variable)
Definition: PropertyHelper.h:16
Compile time string hash class.
Definition: StringHash.h:59
Person in building logic.
Definition: PersonInBuildingLogic.h:36
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32