wavelength 1.0.0
Loading...
Searching...
No Matches
clientinfopkt.h
Go to the documentation of this file.
1#pragma once
2
5#include "os/mem.h"
6
13extern int g_nClientInfoPktType;
14
22public:
28 ClientInfoPkt() = default;
29
38 ClientInfoPkt(const NetLaunchpadPlayer &player, int nReceiver)
39 : InternalPacket(kFlagOrdered | kFlagGuaranteed, nReceiver), mPlayer(player) {
40 }
41
49 static Message *New();
50
57 void *operator new(size_t nSize) {
58 return PoolMemAlloc(static_cast<int>(nSize), "ClientInfoPkt", 0);
59 }
60
66 void operator delete(void *pBlock) {
67 PoolMemFree(pBlock);
68 }
69
75 Message *Clone() override {
76 return new ClientInfoPkt(*this);
77 }
78
84 int Type() override {
86 }
87
93 const char *GetName() const override {
94 return "ClientInfoPkt";
95 }
96
104 void PrintExtra(PrnStream &stream) const override;
105
113 void saveGuts(BinStream &stream) const override;
114
122 void restoreGuts(BinStream &stream) override;
123
126 return mPlayer;
127 }
128
129private:
130 NetLaunchpadPlayer mPlayer;
131};
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
Message * Clone() override
Produce a heap copy of this packet.
Definition clientinfopkt.h:75
const char * GetName() const override
Report this packet's class name.
Definition clientinfopkt.h:93
ClientInfoPkt(const NetLaunchpadPlayer &player, int nReceiver)
Construct a packet for one peer, ordered and guaranteed.
Definition clientinfopkt.h:38
ClientInfoPkt()=default
Construct a packet with a default LobbyPlayer.
static Message * New()
Produce a default-constructed packet on the heap.
void restoreGuts(BinStream &stream) override
Read the player.
int Type() override
Report this packet's registered identity.
Definition clientinfopkt.h:84
void PrintExtra(PrnStream &stream) const override
Write the sender, the receiver, and the player.
const NetLaunchpadPlayer & GetPlayer() const
Definition clientinfopkt.h:125
void saveGuts(BinStream &stream) const override
Write the player.
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
Text output stream.
Definition prnstream.h:16
int g_nClientInfoPktType
Identity that ClientInfoPkt::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 player of the online session this console is in.
Definition netlaunchpadplayer.h:13