Emergency 20 Dokumentation  4.2.0
MultiplayPvPGameMode.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 //[-------------------------------------------------------]
15 
16 #include <unordered_map>
17 #include <unordered_set>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25  namespace multiplayer
26  {
27  namespace server
28  {
29  class Host;
30  }
31  }
32 }
33 namespace qsf
34 {
35  namespace game
36  {
37  class BitStream;
38  }
39 }
40 
41 
42 //[-------------------------------------------------------]
43 //[ Namespace ]
44 //[-------------------------------------------------------]
45 namespace em5
46 {
47 
48 
49  //[-------------------------------------------------------]
50  //[ Classes ]
51  //[-------------------------------------------------------]
57  {
58 
59 
60  //[-------------------------------------------------------]
61  //[ Public boost signals ]
62  //[-------------------------------------------------------]
63  public:
71  boost::signals2::signal<void(uint32, const std::string&)> newEventArrived;
72 
73 
74  //[-------------------------------------------------------]
75  //[ Public methods ]
76  //[-------------------------------------------------------]
77  public:
83 
88  virtual ~MultiplayPvPGameMode();
89 
90 
91  //[-------------------------------------------------------]
92  //[ Public virtual em5::GameMode methods ]
93  //[-------------------------------------------------------]
94  public:
95  virtual std::string getGameModeAsString() const override;
96  virtual void startup() override;
97  virtual void updateGameMode(qsf::Time timePassed) override;
98  virtual void onGameLoaded() override;
99  virtual bool isSingleInteraction() const override; // "true" means that only one player can interact with the event object
100 
101 
102  //[-------------------------------------------------------]
103  //[ Protected virtual em5::FreeplayGameMode methods ]
104  //[-------------------------------------------------------]
105  protected:
106  virtual void onEventSucceeded(const qsf::MessageParameters& parameters) override;
107  virtual void onEventFailed(const qsf::MessageParameters& parameters) override;
108  virtual void onReceiveObjectivePoints(const qsf::MessageParameters& parameters) override;
109  virtual void onSetPointGain(const FreeplayEvent::EventResult& eventResult, int32 pointGain) override;
110  virtual void onFirstEventCompleted() override;
111 
112 
113  //[-------------------------------------------------------]
114  //[ Protected methods ]
115  //[-------------------------------------------------------]
116  protected:
117  void onEventFinished(const FreeplayEvent::EventResult& eventResult, bool success);
118  void onEventTriggered(const qsf::MessageParameters& parameters);
119  void assignEventToPlayer(FreeplayEvent& freeplayEvent, uint32 playerIndex);
120  bool anyEventSlotFree() const;
121 
122 
123  //[-------------------------------------------------------]
124  //[ Protected data ]
125  //[-------------------------------------------------------]
126  protected:
130  std::unordered_map<uint32, std::unordered_set<uint32>> mPerPlayerActiveEventCount;
131  std::vector<uint32> mPlayerListToChooseFrom;
134 
135 
136  //[-------------------------------------------------------]
137  //[ CAMP reflection system ]
138  //[-------------------------------------------------------]
139  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
140 
141 
142  };
143 
144 
145 //[-------------------------------------------------------]
146 //[ Namespace ]
147 //[-------------------------------------------------------]
148 } // em5
149 
150 
151 //[-------------------------------------------------------]
152 //[ CAMP reflection system ]
153 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Definition: FreeplayEvent.h:110
std::unordered_map< uint32, std::unordered_set< uint32 > > mPerPlayerActiveEventCount
Definition: MultiplayPvPGameMode.h:130
Message parameters class.
Definition: MessageParameters.h:34
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
bool mEndlessMode
Definition: MultiplayPvPGameMode.h:128
Message listener proxy class.
Definition: MessageProxy.h:47
EMERGENCY 5 multiplay PVP game mode.
Definition: MultiplayPvPGameMode.h:56
Definition: PickupPersonByParamedicAction.h:21
EMERGENCY 5 multiplayer host class.
Definition: Host.h:82
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
qsf::MessageProxy mEventTriggeredMessageProxy
Message proxy for the "freeplay event triggered" message.
Definition: MultiplayPvPGameMode.h:133
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
signed int int32
Definition: PlatformTypes.h:180
uint16 mMaxEventsPerPlayer
Definition: MultiplayPvPGameMode.h:132
unsigned short uint16
Definition: PlatformTypes.h:178
qsf::Time mRemainingTime
Definition: MultiplayPvPGameMode.h:127
std::vector< uint32 > mPlayerListToChooseFrom
Definition: MultiplayPvPGameMode.h:131
Abstract EMERGENCY 5 freeplay event base class.
Definition: FreeplayEvent.h:66
boost::signals2::signal< void(uint32, const std::string &)> newEventArrived
Called when a new event has arrived for selection.
Definition: MultiplayPvPGameMode.h:71
EMERGENCY 5 freeplay game mode.
Definition: FreeplayGameMode.h:48
multiplayer::server::Host * mMultiplayerHost
Definition: MultiplayPvPGameMode.h:129
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32