summaryrefslogtreecommitdiff
path: root/src/network/core/packet.h
diff options
context:
space:
mode:
authorRubidium <rubidium@openttd.org>2021-04-21 07:10:09 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-04-24 20:42:01 +0200
commit450178d780eb885717c53a2dad62587332efc0f4 (patch)
tree4536234455f40e6bd38060e198859790cef1c2fa /src/network/core/packet.h
parent3abefdf56190ef55d8680acb1aeab9f1b2fc8108 (diff)
downloadopenttd-450178d780eb885717c53a2dad62587332efc0f4.tar.xz
Codechange: add accessor for the packet type to Packet and make the internal state of Packet private
Diffstat (limited to 'src/network/core/packet.h')
-rw-r--r--src/network/core/packet.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/core/packet.h b/src/network/core/packet.h
index d7ab7fee6..1a9c9faea 100644
--- a/src/network/core/packet.h
+++ b/src/network/core/packet.h
@@ -40,6 +40,7 @@ typedef uint8 PacketType; ///< Identifier for the packet
* (year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))
*/
struct Packet {
+private:
/** The next packet. Used for queueing packets before sending. */
Packet *next;
/**
@@ -52,8 +53,6 @@ struct Packet {
PacketSize pos;
/** The buffer of this packet, of basically variable length up to SEND_MTU. */
byte *buffer;
-
-private:
/** Socket we're associated with. */
NetworkSocketHandler *cs;
@@ -82,6 +81,7 @@ public:
bool ParsePacketSize();
size_t Size() const;
void PrepareToRead();
+ PacketType GetPacketType() const;
bool CanReadFromPacket(size_t bytes_to_read, bool close_connection = false);
bool Recv_bool ();