Emergency 20 Dokumentation  4.2.0
FreeplayEventManager.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 #include <boost/container/flat_map.hpp>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Namespace ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25 
26 
27  //[-------------------------------------------------------]
28  //[ Classes ]
29  //[-------------------------------------------------------]
35  {
36 
37 
38  //[-------------------------------------------------------]
39  //[ Friends ]
40  //[-------------------------------------------------------]
41  friend class FreeplaySystem; // May insert and remove freeplay events
42  friend class FreeplayEventGenerator; // May destroy events
43 
44 
45  //[-------------------------------------------------------]
46  //[ Public definitions ]
47  //[-------------------------------------------------------]
48  public:
49  typedef std::vector<uint32> EventIdArray;
50  typedef boost::container::flat_map<uint32, FreeplayEvent*> EventMap;
51 
52 
53  //[-------------------------------------------------------]
54  //[ Public methods ]
55  //[-------------------------------------------------------]
56  public:
62 
68 
69  void clear();
70 
71  void startup();
72  void shutdown();
73 
74  uint32 getNumberOfActiveEvents() const;
75 
76  void updateEvents(const qsf::Time& timePassed);
77 
78  FreeplayEvent* getEventById(uint32 eventId) const;
79 
84  const EventMap& getCurrentEvents() const;
85 
90  FreeplayEvent* getLastEvent() const;
91 
92  //[-------------------------------------------------------]
93  //[ Serialize ]
94  //[-------------------------------------------------------]
95  void serialize(qsf::BinarySerializer& serializer);
96 
97 
98  //[-------------------------------------------------------]
99  //[ Private methods ]
100  //[-------------------------------------------------------]
101  private:
102  void insertEvent(FreeplayEvent& freeplayEvent);
103  void onEventFinished(FreeplayEvent& freeplayEvent, FreeplayEvent::EventResult& eventResult);
104  void onObjectiveGetsPoints(FreeplayEvent& freeplayEvent, FreeplayEvent::ObjectiveResult& objectiveResult);
105  void onAbortEvent(FreeplayEvent& freeplayEvent);
106 
111  void flushEventsToBeRemoved();
112 
117  void destroyEvent(FreeplayEvent& freeplayEvent);
118 
119 
120  //[-------------------------------------------------------]
121  //[ Private static methods ]
122  //[-------------------------------------------------------]
123  private:
128  static FreeplayEvent* createFreeplayEventById(uint32 campId);
129 
130 
131  //[-------------------------------------------------------]
132  //[ Private definitions ]
133  //[-------------------------------------------------------]
134  private:
135  typedef std::vector<FreeplayEvent*> EventArray;
136 
137 
138  //[-------------------------------------------------------]
139  //[ Private data ]
140  //[-------------------------------------------------------]
141  private:
142  EventMap mEvents;
143  EventArray mEventsToBeRemoved;
144 
146 
147 
148  };
149 
150 
151 //[-------------------------------------------------------]
152 //[ Namespace ]
153 //[-------------------------------------------------------]
154 } // em5
Definition: ActionPriority.h:13
Definition: FreeplayEvent.h:110
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: FreeplayEvent.h:131
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
boost::container::flat_map< uint32, FreeplayEvent * > EventMap
Definition: FreeplayEventManager.h:50
std::vector< uint32 > EventIdArray
Definition: FreeplayEventManager.h:49
EMERGENCY 5 freeplay event generation class.
Definition: FreeplayEventGenerator.h:46
EMERGENCY 5 freeplay event factory manager.
Definition: FreeplayEventManager.h:34
Abstract EMERGENCY 5 freeplay event base class.
Definition: FreeplayEvent.h:66
Binary serializer class.
Definition: BinarySerializer.h:35
EMERGENCY 5 freeplay system.
Definition: FreeplaySystem.h:55
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32