wavelength 1.0.0
Loading...
Searching...
No Matches
clientstatuspkt.h
Go to the documentation of this file.
1#pragma once
2
4#include "os/mem.h"
5
12extern int g_nClientStatusPktType;
13
21public:
28 ~ClientStatusPkt() override = default;
29
35 ClientStatusPkt() = default;
36
44 explicit ClientStatusPkt(int nReady)
46 }
47
55 static Message *New();
56
63 void *operator new(size_t nSize) {
64 return PoolMemAlloc(static_cast<int>(nSize), "ClientStatusPkt", 0);
65 }
66
72 void operator delete(void *pBlock) {
73 PoolMemFree(pBlock);
74 }
75
81 Message *Clone() override {
82 return new ClientStatusPkt(*this);
83 }
84
90 int Type() override {
92 }
93
99 const char *GetName() const override {
100 return "ClientStatusPkt";
101 }
102
110 void PrintExtra(PrnStream &stream) const override;
111
119 void saveGuts(BinStream &stream) const override;
120
128 void restoreGuts(BinStream &stream) override;
129
131 int GetReady() const {
132 return mReady;
133 }
134
135private:
136 int mReady;
137};
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
int GetReady() const
Definition clientstatuspkt.h:131
int Type() override
Report this packet's registered identity.
Definition clientstatuspkt.h:90
Message * Clone() override
Produce a heap copy of this packet.
Definition clientstatuspkt.h:81
static Message * New()
Produce a default-constructed packet on the heap.
~ClientStatusPkt() override=default
Destroy the object.
void restoreGuts(BinStream &stream) override
Read the state as a signed byte.
void saveGuts(BinStream &stream) const override
Write the state as a byte.
const char * GetName() const override
Report this packet's class name.
Definition clientstatuspkt.h:99
ClientStatusPkt()=default
Construct a packet with mReady left unset.
ClientStatusPkt(int nReady)
Construct a packet for every peer, ordered and guaranteed.
Definition clientstatuspkt.h:44
void PrintExtra(PrnStream &stream) const override
Write the sender, the receiver, and the state.
InternalPacket(unsigned char nFlags=0, int nReceiver=kUnset)
Construct a packet from an unset sender.
Definition internalpacket.h:33
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
static constexpr unsigned char kFlagGuaranteed
Bit of mFlags that NetTransport::Send() turns into its guaranteed delivery bit.
Definition packet.h:28
static constexpr unsigned char kFlagOrdered
Bit of mFlags that LaunchpadRT::Send() turns into the second delivery bit of the session library.
Definition packet.h:25
static constexpr int kAllPeers
Value of mReceiver that addresses every peer.
Definition packet.h:19
Text output stream.
Definition prnstream.h:16
int g_nClientStatusPktType
Identity that ClientStatusPkt::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.