wavelength 1.0.0
Loading...
Searching...
No Matches
loginresultmsg.h
Go to the documentation of this file.
1#pragma once
2
3#include "msg/message.h"
6#include "os/mem.h"
7
13class LoginResultMsg : public Message {
14public:
21 ~LoginResultMsg() override = default;
22
32
40 explicit LoginResultMsg(int nResult) : mResult(nResult) {
41 }
42
53 LoginResultMsg(int nResult,
54 const char *pszNews,
55 const char *pszEula,
56 const NetChatroomInfo &chatroom)
57 : mResult(nResult), mNews(pszNews), mEula(pszEula), mChatroom(chatroom) {
58 }
59
66 void *operator new(size_t nSize) {
67 return PoolMemAlloc(static_cast<int>(nSize), "LoginResultMsg", 0);
68 }
69
75 void operator delete(void *pBlock) {
76 PoolMemFree(pBlock);
77 }
78
84 Message *Clone() override {
85 return new LoginResultMsg(*this);
86 }
87
93 int Type() override {
95 }
96
102 const char *GetName() const override {
103 return "LoginResultMsg";
104 }
105
113 void PrintExtra(PrnStream &stream) const override;
114
117 return mChatroom;
118 }
119
121 const char *GetEula() const {
122 return mEula;
123 }
124
126 const char *GetNews() const {
127 return mNews;
128 }
129
131 int GetResult() const {
132 return mResult;
133 }
134
135private:
136 int mResult;
137 const char *mNews;
138 const char *mEula;
139 NetChatroomInfo mChatroom;
140};
void PrintExtra(PrnStream &stream) const override
Write the result, and after a success the chatroom, the news, and the licence agreement.
LoginResultMsg(int nResult, const char *pszNews, const char *pszEula, const NetChatroomInfo &chatroom)
Construct a result.
Definition loginresultmsg.h:53
LoginResultMsg(int nResult)
Construct a failure, whose chatroom has the identifier -1.
Definition loginresultmsg.h:40
const NetChatroomInfo & GetChatroom() const
Definition loginresultmsg.h:116
Message * Clone() override
Produce a heap copy of this message.
Definition loginresultmsg.h:84
int Type() override
Report this message's registered identity.
Definition loginresultmsg.h:93
~LoginResultMsg() override=default
Destroy the object.
const char * GetEula() const
Definition loginresultmsg.h:121
int GetResult() const
Definition loginresultmsg.h:131
const char * GetName() const override
Report this message's class name.
Definition loginresultmsg.h:102
const char * GetNews() const
Definition loginresultmsg.h:126
Result
Values of mResult.
Definition loginresultmsg.h:24
@ kResultStatsFailed
Definition loginresultmsg.h:29
@ kResultServerError
Definition loginresultmsg.h:25
@ kResultInvalidPassword
Definition loginresultmsg.h:27
@ kResultAlreadyLoggedIn
Definition loginresultmsg.h:28
@ kResultSuccess
Definition loginresultmsg.h:30
@ kResultAccountNotFound
Definition loginresultmsg.h:26
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_nLoginResultMsgType
Identity that LoginResultMsg::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