wavelength 1.0.0
Loading...
Searching...
No Matches
startgamemsg.h
Go to the documentation of this file.
1#pragma once
2
3#include "msg/message.h"
4#include "os/mem.h"
5
12extern int g_nStartGameMsgType;
13
20class StartGameMsg : public Message {
21public:
29 explicit StartGameMsg(int nSeed) : mSeed(nSeed) {
30 }
31
38 void *operator new(size_t nSize) {
39 return PoolMemAlloc(static_cast<int>(nSize), "StartGameMsg", 0);
40 }
41
47 void operator delete(void *pBlock) {
48 PoolMemFree(pBlock);
49 }
50
56 Message *Clone() override {
57 return new StartGameMsg(*this);
58 }
59
65 int Type() override {
67 }
68
74 const char *GetName() const override {
75 return "StartGameMsg";
76 }
77
85 void PrintExtra(PrnStream &stream) const override;
86
88 int GetSeed() const {
89 return mSeed;
90 }
91
92private:
93 int mSeed;
94};
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 Type() override
Report this message's registered identity.
Definition startgamemsg.h:65
const char * GetName() const override
Report this message's class name.
Definition startgamemsg.h:74
int GetSeed() const
Definition startgamemsg.h:88
StartGameMsg(int nSeed)
Construct a message with a seed.
Definition startgamemsg.h:29
Message * Clone() override
Produce a heap copy of this message.
Definition startgamemsg.h:56
void PrintExtra(PrnStream &stream) const override
Write the seed.
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.
int g_nStartGameMsgType
Identity that StartGameMsg::Type() reports.