wavelength 1.0.0
Loading...
Searching...
No Matches
playerrankmsg.h
Go to the documentation of this file.
1#pragma once
2
3#include "msg/message.h"
5#include "os/mem.h"
6
13class PlayerRankMsg : public Message {
14public:
21 ~PlayerRankMsg() override = default;
22
31 PlayerRankMsg(int nAccount, int nRank) : mAccount(nAccount), mRank(nRank) {
32 }
33
40 void *operator new(size_t nSize) {
41 return PoolMemAlloc(static_cast<int>(nSize), "PlayerRankMsg", 0);
42 }
43
49 void operator delete(void *pBlock) {
50 PoolMemFree(pBlock);
51 }
52
58 Message *Clone() override {
59 return new PlayerRankMsg(*this);
60 }
61
67 int Type() override {
69 }
70
76 const char *GetName() const override {
77 return "PlayerRankMsg";
78 }
79
87 void PrintExtra(PrnStream &stream) const override;
88
90 int GetAccount() const {
91 return mAccount;
92 }
93
95 int GetRank() const {
96 return mRank;
97 }
98
99private:
100 int mAccount;
101 int mRank;
102};
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
Message * Clone() override
Produce a heap copy of this message.
Definition playerrankmsg.h:58
int GetRank() const
Definition playerrankmsg.h:95
PlayerRankMsg(int nAccount, int nRank)
Construct a message.
Definition playerrankmsg.h:31
const char * GetName() const override
Report this message's class name.
Definition playerrankmsg.h:76
int Type() override
Report this message's registered identity.
Definition playerrankmsg.h:67
void PrintExtra(PrnStream &stream) const override
Write the account and the rank.
int GetAccount() const
Definition playerrankmsg.h:90
~PlayerRankMsg() override=default
Destroy the object.
Text output stream.
Definition prnstream.h:16
int g_nPlayerRankMsgType
Identity that PlayerRankMsg::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.