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

@@ -233,7 +233,7 @@ void ServerNetworkUDPSocketHandler::Reply_CLIENT_FIND_SERVER_extended(Packet *p,
uint16 flags = p->Recv_uint16();
uint16 version = p->Recv_uint16();
Packet packet(PACKET_UDP_EX_SERVER_RESPONSE);
Packet packet(PACKET_UDP_EX_SERVER_RESPONSE, SHRT_MAX);
this->SendNetworkGameInfoExtended(&packet, ngi, flags, version);
/* Let the client know that we are here */
@@ -297,10 +297,10 @@ void ServerNetworkUDPSocketHandler::Receive_CLIENT_DETAIL_INFO(Packet *p, Networ
/**
* A client has requested the names of some NewGRFs.
*
* Replying this can be tricky as we have a limit of SEND_MTU bytes
* Replying this can be tricky as we have a limit of UDP_MTU bytes
* in the reply packet and we can send up to 100 bytes per NewGRF
* (GRF ID, MD5sum and NETWORK_GRF_NAME_LENGTH bytes for the name).
* As SEND_MTU is _much_ less than 100 * NETWORK_MAX_GRF_COUNT, it
* As UDP_MTU is _much_ less than 100 * NETWORK_MAX_GRF_COUNT, it
* could be that a packet overflows. To stop this we only reply
* with the first N NewGRFs so that if the first N + 1 NewGRFs
* would be sent, the packet overflows.
@@ -371,7 +371,7 @@ void ServerNetworkUDPSocketHandler::Receive_CLIENT_GET_NEWGRFS(Packet *p, Networ
* The name could be an empty string, if so take the filename. */
size_t required_length = sizeof(info.ident.grfid) + sizeof(info.ident.md5sum) +
std::min(strlen(info.name) + 1, (size_t)NETWORK_GRF_NAME_LENGTH);
if (packet_len + required_length > SEND_MTU_SHORT - 4) { // 4 is 3 byte header + grf count in reply
if (packet_len + required_length > UDP_MTU_SHORT - 4) { // 4 is 3 byte header + grf count in reply
flush_response();
}
packet_len += required_length;