Emergency 20 Dokumentation  4.2.0
CoolingObserver.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 
15 #include <qsf/job/JobProxy.h>
17 
18 
19 //[-------------------------------------------------------]
20 //[ Forward declarations ]
21 //[-------------------------------------------------------]
22 namespace em5
23 {
24  class Objective;
25 }
26 
27 
28 //[-------------------------------------------------------]
29 //[ Namespace ]
30 //[-------------------------------------------------------]
31 namespace em5
32 {
33 
34 
35  //[-------------------------------------------------------]
36  //[ Classes ]
37  //[-------------------------------------------------------]
48  {
49 
50 
51  //[-------------------------------------------------------]
52  //[ Public definitions ]
53  //[-------------------------------------------------------]
54  public:
55  static const uint32 GAMELOGIC_TYPE_ID; // "em5::CoolingObserver" game logic type ID
56 
57 
58  //[-------------------------------------------------------]
59  //[ Public methods ]
60  //[-------------------------------------------------------]
61  public:
67 
72  void initialize(Objective& objective, uint32 minCoolingSources, float neededCoolingEnergy);
73 
74 
75  //[-------------------------------------------------------]
76  //[ Public virtual qsf::GameLogic methods ]
77  //[-------------------------------------------------------]
78  public:
79  virtual bool onStartup() override;
80  virtual void onShutdown() override;
81  virtual void serialize(qsf::BinarySerializer& serializer) override;
82 
83 
84  //[-------------------------------------------------------]
85  //[ Private methods ]
86  //[-------------------------------------------------------]
87  private:
92  void onCoolingEnergySourcesChange(const qsf::MessageParameters& parameters);
93 
98  void updateSimulation(const qsf::JobArguments& jobArguments);
99 
104  void checkCooling();
105 
110  uint32 getCoolingSourceCount();
111 
112 
113  //[-------------------------------------------------------]
114  //[ Private data ]
115  //[-------------------------------------------------------]
116  private:
117  // Constant data
118  uint32 mObjectiveId;
119  uint32 mMinCoolingSources;
120  float mNeededCoolingEnergy;
121  qsf::MessageConfiguration mCoolingMessage;
122 
123  // Internal data
124  float mLeftCoolingEnergy;
125  qsf::MessageProxy mCoolingMessageProxy;
126  qsf::JobProxy mCoolingJobProxy;
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 observer base class.
Definition: Observer.h:41
Job proxy class.
Definition: JobProxy.h:51
Message parameters class.
Definition: MessageParameters.h:34
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Message listener proxy class.
Definition: MessageProxy.h:47
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
EMERGENCY 5 objective class.
Definition: Objective.h:51
#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
Message configuration class.
Definition: MessageConfiguration.h:44
static const uint32 GAMELOGIC_TYPE_ID
Definition: CoolingObserver.h:55
Binary serializer class.
Definition: BinarySerializer.h:35
EMERGENCY 5 logic observer cooling observer.
Definition: CoolingObserver.h:47