Emergency 20 Dokumentation  4.2.0
MessageObjectiveGeneralObserver.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 
16 
17 
18 //[-------------------------------------------------------]
19 //[ Forward declarations ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23  class Objective;
24 }
25 
26 
27 //[-------------------------------------------------------]
28 //[ Namespace ]
29 //[-------------------------------------------------------]
30 namespace em5
31 {
32 
33 
34  //[-------------------------------------------------------]
35  //[ Classes ]
36  //[-------------------------------------------------------]
46  {
47 
48 
49  //[-------------------------------------------------------]
50  //[ Public definitions ]
51  //[-------------------------------------------------------]
52  public:
53  static const uint32 GAMELOGIC_TYPE_ID; // "em5::MessageObjectiveGeneralObserver" game logic type ID
54 
56  {
61  REACTION_INC_NEEDED_NUMBER
62  };
63 
64 
65  //[-------------------------------------------------------]
66  //[ Public methods ]
67  //[-------------------------------------------------------]
68  public:
74 
82  void registerMessage(const qsf::MessageConfiguration& configuration);
83 
93  void registerMessage(const qsf::MessageConfiguration& configuration, uint32 entityIdFilter);
94 
104  void registerMessage(const qsf::MessageConfiguration& configuration, std::string entityIdParameter);
105 
115  void connectToObjective(Objective& objective, ObserverReactionType observerReaction);
116 
117 
118  //[-------------------------------------------------------]
119  //[ Public virtual qsf::GameLogic methods ]
120  //[-------------------------------------------------------]
121  public:
122  virtual bool onStartup() override;
123  virtual void onShutdown() override;
124  virtual void serialize(qsf::BinarySerializer& serializer) override;
125 
126 
127  //[-------------------------------------------------------]
128  //[ Private methods ]
129  //[-------------------------------------------------------]
130  private:
135  void registerMessageProxy(const qsf::MessageConfiguration& configuration);
136 
144  qsf::Entity* getEntityFromMessage(const qsf::MessageParameters& parameters);
145 
150  void onMessage(const qsf::MessageParameters& parameters);
151 
152 
153  //[-------------------------------------------------------]
154  //[ Private data ]
155  //[-------------------------------------------------------]
156  private:
157  uint32 mObjectiveId;
158  ObserverReactionType mObserverReaction;
159  qsf::MessageProxy mMessageProxy;
160  qsf::MessageConfiguration mConfiguration;
161  uint32 mEntityIdFilter;
162  std::string mEntityIdParameter;
163 
164 
165  //[-------------------------------------------------------]
166  //[ CAMP reflection system ]
167  //[-------------------------------------------------------]
168  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
169 
170 
171  };
172 
173 
174 //[-------------------------------------------------------]
175 //[ Namespace ]
176 //[-------------------------------------------------------]
177 } // em5
178 
179 
180 //[-------------------------------------------------------]
181 //[ CAMP reflection system ]
182 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Definition: MessageObjectiveGeneralObserver.h:58
Entity class.
Definition: Entity.h:46
Message parameters class.
Definition: MessageParameters.h:34
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: MessageObjectiveGeneralObserver.h:60
Definition: MessageObjectiveGeneralObserver.h:59
Message listener proxy class.
Definition: MessageProxy.h:47
EMERGENCY 5 general observer logic that reacts on a given message configuration.
Definition: MessageObjectiveGeneralObserver.h:45
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
ObserverReactionType
Definition: MessageObjectiveGeneralObserver.h:55
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
Definition: MessageObjectiveGeneralObserver.h:57
static const uint32 GAMELOGIC_TYPE_ID
Definition: MessageObjectiveGeneralObserver.h:53
Binary serializer class.
Definition: BinarySerializer.h:35