Merge branch 'master' into jgrpp

# Conflicts:
#	src/company_cmd.cpp
#	src/lang/japanese.txt
#	src/network/core/config.h
#	src/network/core/packet.cpp
#	src/network/core/tcp.cpp
#	src/network/network_content.cpp
#	src/network/network_server.cpp
#	src/network/network_udp.cpp
#	src/toolbar_gui.cpp
#	src/vehicle_gui_base.h
This commit is contained in:
Jonathan G Rennison
2021-04-25 22:03:49 +01:00
98 changed files with 1370 additions and 1193 deletions

View File

@@ -26,10 +26,11 @@ typedef uint8 PacketType; ///< Identifier for the packet
* Internal entity of a packet. As everything is sent as a packet,
* all network communication will need to call the functions that
* populate the packet.
* Every packet can be at most SEND_MTU bytes. Overflowing this
* limit will give an assertion when sending (i.e. writing) the
* packet. Reading past the size of the packet when receiving
* will return all 0 values and "" in case of the string.
* Every packet can be at most a limited number bytes set in the
* constructor. Overflowing this limit will give an assertion when
* sending (i.e. writing) the packet. Reading past the size of the
* packet when receiving will return all 0 values and "" in case of
* the string.
*
* --- Points of attention ---
* - all > 1 byte integral values are written in little endian,
@@ -46,13 +47,15 @@ private:
PacketSize pos;
/** The buffer of this packet. */
std::vector<byte> buffer;
/** The limit for the packet size. */
size_t limit;
/** Socket we're associated with. */
NetworkSocketHandler *cs;
public:
Packet(NetworkSocketHandler *cs, size_t initial_read_size = sizeof(PacketSize));
Packet(PacketType type);
Packet(NetworkSocketHandler *cs, size_t limit, size_t initial_read_size = sizeof(PacketSize));
Packet(PacketType type, size_t limit = COMPAT_MTU);
void ResetState(PacketType type);