wavelength 1.0.0
Loading...
Searching...
No Matches
lobbyplayersmsg.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4
5#include "msg/message.h"
7#include "os/mem.h"
8
15extern int g_nLobbyPlayersMsgType;
16
23class LobbyPlayersMsg : public Message {
24public:
31 ~LobbyPlayersMsg() override = default;
32
34 static constexpr int kNoLaunchpad = -1;
35
45 LobbyPlayersMsg(std::list<LobbyPlayer> *pPlayers, int nLaunchpad, int nHasPrevious)
46 : mPlayers(pPlayers), mLaunchpad(nLaunchpad), mHasPrevious(nHasPrevious) {
47 }
48
55 void *operator new(size_t nSize) {
56 return PoolMemAlloc(static_cast<int>(nSize), "LobbyPlayersMsg", 0);
57 }
58
64 void operator delete(void *pBlock) {
65 PoolMemFree(pBlock);
66 }
67
73 Message *Clone() override {
74 return new LobbyPlayersMsg(*this);
75 }
76
82 int Type() override {
84 }
85
91 const char *GetName() const override {
92 return "LobbyPlayersMsg";
93 }
94
102 void PrintExtra(PrnStream &stream) const override;
103
105 int GetHasPrevious() const {
106 return mHasPrevious;
107 }
108
110 int GetLaunchpad() const {
111 return mLaunchpad;
112 }
113
115 std::list<LobbyPlayer> *GetPlayers() const {
116 return mPlayers;
117 }
118
119private:
120 std::list<LobbyPlayer> *mPlayers;
121 int mLaunchpad;
122 int mHasPrevious;
123};
const char * GetName() const override
Report this message's class name.
Definition lobbyplayersmsg.h:91
void PrintExtra(PrnStream &stream) const override
Write the session when there is one, and the players.
int Type() override
Report this message's registered identity.
Definition lobbyplayersmsg.h:82
static constexpr int kNoLaunchpad
The value of mLaunchpad when the players are not those of a session.
Definition lobbyplayersmsg.h:34
std::list< LobbyPlayer > * GetPlayers() const
Definition lobbyplayersmsg.h:115
Message * Clone() override
Produce a heap copy of this message, which points at the same players.
Definition lobbyplayersmsg.h:73
int GetLaunchpad() const
Definition lobbyplayersmsg.h:110
LobbyPlayersMsg(std::list< LobbyPlayer > *pPlayers, int nLaunchpad, int nHasPrevious)
Construct a message that points at the players.
Definition lobbyplayersmsg.h:45
int GetHasPrevious() const
Definition lobbyplayersmsg.h:105
~LobbyPlayersMsg() override=default
Destroy the object.
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
Text output stream.
Definition prnstream.h:16
int g_nLobbyPlayersMsgType
Identity that LobbyPlayersMsg::Type() reports.
void * PoolMemAlloc(int nSize, const char *pszTag, int nAlign)
Allocate a block from the pool heaps and bill it to a tag.
void PoolMemFree(void *pBlock)
Return a block PoolMemAlloc() handed out to the pool heap that owns it.