wavelength 1.0.0
Loading...
Searching...
No Matches
findplayermsg.h
Go to the documentation of this file.
1#pragma once
2
3#include "msg/message.h"
7#include "os/mem.h"
8
15class FindPlayerMsg : public Message {
16public:
24 explicit FindPlayerMsg(int nResult) : mResult(nResult) {
25 }
26
36 FindPlayerMsg(int nResult, const LobbyPlayer &player, const NetChatroomInfo &chatroom)
37 : mResult(nResult), mPlayer(player), mChatroom(chatroom) {
38 }
39
46 void *operator new(size_t nSize) {
47 return PoolMemAlloc(static_cast<int>(nSize), "FindPlayerMsg", 0);
48 }
49
55 void operator delete(void *pBlock) {
56 PoolMemFree(pBlock);
57 }
58
64 Message *Clone() override {
65 return new FindPlayerMsg(*this);
66 }
67
73 int Type() override {
75 }
76
82 const char *GetName() const override {
83 return "FindPlayerMsg";
84 }
85
93 void PrintExtra(PrnStream &stream) const override;
94
98 return mChatroom;
99 }
100
102 const LobbyPlayer &GetPlayer() const {
103 return mPlayer;
104 }
105
107 int GetResult() const {
108 return mResult;
109 }
110
111private:
112 int mResult;
113 LobbyPlayer mPlayer;
114 NetChatroomInfo mChatroom;
116};
void PrintExtra(PrnStream &stream) const override
Write the error, or the player and the chatroom.
const NetChatroomInfo & GetChatroom() const
Definition findplayermsg.h:97
const char * GetName() const override
Report this message's class name.
Definition findplayermsg.h:82
const LobbyPlayer & GetPlayer() const
Definition findplayermsg.h:102
FindPlayerMsg(int nResult, const LobbyPlayer &player, const NetChatroomInfo &chatroom)
Construct a result.
Definition findplayermsg.h:36
FindPlayerMsg(int nResult)
Construct a failure, with a default player and a chatroom whose identifier is -1.
Definition findplayermsg.h:24
Message * Clone() override
Produce a heap copy of this message.
Definition findplayermsg.h:64
int GetResult() const
Definition findplayermsg.h:107
int Type() override
Report this message's registered identity.
Definition findplayermsg.h:73
A player of the lobby server, as FindPlayerMsg reports it.
Definition lobbyplayer.h:16
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_nFindPlayerMsgType
Identity that FindPlayerMsg::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.
The description of one chat room of the online lobby.
Definition netchatroominfo.h:11