Merge branch 'master' into jgrpp
# Conflicts: # cmake/CompileFlags.cmake # src/aircraft_cmd.cpp # src/blitter/32bpp_anim.cpp # src/cargopacket.cpp # src/cheat_gui.cpp # src/company_cmd.cpp # src/company_gui.cpp # src/core/pool_func.hpp # src/date.cpp # src/economy.cpp # src/error_gui.cpp # src/ground_vehicle.cpp # src/ground_vehicle.hpp # src/group_gui.cpp # src/industry_cmd.cpp # src/lang/dutch.txt # src/lang/french.txt # src/lang/german.txt # src/linkgraph/linkgraph_gui.cpp # src/linkgraph/mcf.cpp # src/network/network_content.cpp # src/network/network_server.cpp # src/network/network_udp.cpp # src/newgrf_engine.cpp # src/newgrf_station.cpp # src/order_cmd.cpp # src/order_gui.cpp # src/pathfinder/follow_track.hpp # src/pathfinder/yapf/yapf_common.hpp # src/saveload/saveload.cpp # src/settings_gui.cpp # src/station_cmd.cpp # src/station_kdtree.h # src/string_func.h # src/table/settings.ini # src/tgp.cpp # src/timetable_cmd.cpp # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/town_cmd.cpp # src/train_cmd.cpp # src/train_gui.cpp # src/tree_gui.cpp # src/tunnelbridge_cmd.cpp # src/vehicle.cpp # src/vehicle_gui.cpp # src/video/sdl2_v.cpp # src/video/sdl_v.cpp # src/video/win32_v.cpp # src/viewport.cpp # src/viewport_sprite_sorter_sse4.cpp # src/window.cpp
This commit is contained in:
@@ -250,8 +250,8 @@ int NetworkHTTPSocketHandler::Receive()
|
||||
|
||||
/* Wait till we read the end-of-header identifier */
|
||||
if (this->recv_length == 0) {
|
||||
int read = this->recv_pos + res;
|
||||
int end = min(read, lengthof(this->recv_buffer) - 1);
|
||||
ssize_t read = this->recv_pos + res;
|
||||
ssize_t end = std::min<ssize_t>(read, lengthof(this->recv_buffer) - 1);
|
||||
|
||||
/* Do a 'safe' search for the end of the header. */
|
||||
char prev = this->recv_buffer[end];
|
||||
@@ -272,7 +272,7 @@ int NetworkHTTPSocketHandler::Receive()
|
||||
this->recv_length = ret;
|
||||
|
||||
end_of_header += strlen(END_OF_HEADER);
|
||||
int len = min(read - (end_of_header - this->recv_buffer), res);
|
||||
int len = std::min(read - (end_of_header - this->recv_buffer), res);
|
||||
if (len != 0) {
|
||||
this->callback->OnReceiveData(end_of_header, len);
|
||||
this->recv_length -= len;
|
||||
@@ -281,7 +281,7 @@ int NetworkHTTPSocketHandler::Receive()
|
||||
this->recv_pos = 0;
|
||||
}
|
||||
} else {
|
||||
res = min(this->recv_length, res);
|
||||
res = std::min<ssize_t>(this->recv_length, res);
|
||||
/* Receive whatever we're expecting. */
|
||||
this->callback->OnReceiveData(this->recv_buffer, res);
|
||||
this->recv_length -= res;
|
||||
|
@@ -100,7 +100,7 @@ void NetworkUDPSocketHandler::SendPacket(Packet *p, NetworkAddress *recv, bool a
|
||||
uint8 current_frag = 0;
|
||||
uint16 offset = 0;
|
||||
while (offset < p->size) {
|
||||
uint16 payload_size = min<uint>(PAYLOAD_MTU, p->size - offset);
|
||||
uint16 payload_size = std::min<uint>(PAYLOAD_MTU, p->size - offset);
|
||||
frag.Send_uint64(token);
|
||||
frag.Send_uint8 (current_frag);
|
||||
frag.Send_uint8 (frag_count);
|
||||
@@ -215,7 +215,7 @@ void NetworkUDPSocketHandler::SendNetworkGameInfo(Packet *p, const NetworkGameIn
|
||||
for (c = info->grfconfig; c != nullptr; c = c->next) {
|
||||
if (!HasBit(c->flags, GCF_STATIC)) count++;
|
||||
}
|
||||
p->Send_uint8(min<uint>(count, NETWORK_MAX_GRF_COUNT)); // Send number of GRFs
|
||||
p->Send_uint8(std::min<uint>(count, NETWORK_MAX_GRF_COUNT)); // Send number of GRFs
|
||||
|
||||
/* Send actual GRF Identifications */
|
||||
uint index = 0;
|
||||
|
@@ -413,13 +413,13 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyEconomy()
|
||||
p->Send_uint64(company->money);
|
||||
p->Send_uint64(company->current_loan);
|
||||
p->Send_uint64(income);
|
||||
p->Send_uint16(min(UINT16_MAX, company->cur_economy.delivered_cargo.GetSum<OverflowSafeInt64>()));
|
||||
p->Send_uint16(static_cast<uint16>(std::min<uint64>(UINT16_MAX, company->cur_economy.delivered_cargo.GetSum<OverflowSafeInt64>())));
|
||||
|
||||
/* Send stats for the last 2 quarters. */
|
||||
for (uint i = 0; i < 2; i++) {
|
||||
p->Send_uint64(company->old_economy[i].company_value);
|
||||
p->Send_uint16(company->old_economy[i].performance_history);
|
||||
p->Send_uint16(min(UINT16_MAX, company->old_economy[i].delivered_cargo.GetSum<OverflowSafeInt64>()));
|
||||
p->Send_uint16(static_cast<uint16>(std::min<uint64>(UINT16_MAX, company->old_economy[i].delivered_cargo.GetSum<OverflowSafeInt64>())));
|
||||
}
|
||||
|
||||
this->SendPacket(p);
|
||||
|
@@ -154,7 +154,7 @@ void NetworkUndrawChatMessage()
|
||||
int width = _chatmsg_box.width;
|
||||
int height = _chatmsg_box.height;
|
||||
if (y < 0) {
|
||||
height = max(height + y, min(_chatmsg_box.height, _screen.height));
|
||||
height = std::max(height + y, std::min(_chatmsg_box.height, _screen.height));
|
||||
y = 0;
|
||||
}
|
||||
if (x + width >= _screen.width) {
|
||||
@@ -214,7 +214,7 @@ void NetworkDrawChatMessage()
|
||||
int width = _chatmsg_box.width;
|
||||
int height = _chatmsg_box.height;
|
||||
if (y < 0) {
|
||||
height = max(height + y, min(_chatmsg_box.height, _screen.height));
|
||||
height = std::max(height + y, std::min(_chatmsg_box.height, _screen.height));
|
||||
y = 0;
|
||||
}
|
||||
if (x + width >= _screen.width) {
|
||||
@@ -235,7 +235,7 @@ void NetworkDrawChatMessage()
|
||||
string_height += GetStringLineCount(STR_JUST_RAW_STRING, width - 1) * FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING;
|
||||
}
|
||||
|
||||
string_height = min(string_height, MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING));
|
||||
string_height = std::min<uint>(string_height, MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING));
|
||||
|
||||
int top = _screen.height - _chatmsg_box.y - string_height - 2;
|
||||
int bottom = _screen.height - _chatmsg_box.y - 2;
|
||||
|
@@ -73,7 +73,7 @@ struct PacketReader : LoadFilter {
|
||||
assert(this->read_bytes == 0);
|
||||
|
||||
size_t in_packet = p->size - p->pos;
|
||||
size_t to_write = min((size_t)(this->bufe - this->buf), in_packet);
|
||||
size_t to_write = std::min<size_t>(this->bufe - this->buf, in_packet);
|
||||
const byte *pbuf = p->buffer + p->pos;
|
||||
|
||||
this->written_bytes += in_packet;
|
||||
@@ -98,7 +98,7 @@ struct PacketReader : LoadFilter {
|
||||
size_t Read(byte *rbuf, size_t size) override
|
||||
{
|
||||
/* Limit the amount to read to whatever we still have. */
|
||||
size_t ret_size = size = min(this->written_bytes - this->read_bytes, size);
|
||||
size_t ret_size = size = std::min(this->written_bytes - this->read_bytes, size);
|
||||
this->read_bytes += ret_size;
|
||||
const byte *rbufe = rbuf + ret_size;
|
||||
|
||||
@@ -108,7 +108,7 @@ struct PacketReader : LoadFilter {
|
||||
this->bufe = this->buf + CHUNK;
|
||||
}
|
||||
|
||||
size_t to_write = min(this->bufe - this->buf, rbufe - rbuf);
|
||||
size_t to_write = std::min(this->bufe - this->buf, rbufe - rbuf);
|
||||
memcpy(rbuf, this->buf, to_write);
|
||||
rbuf += to_write;
|
||||
this->buf += to_write;
|
||||
@@ -551,7 +551,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendDesyncLog(const std::strin
|
||||
{
|
||||
for (size_t offset = 0; offset < log.size();) {
|
||||
Packet *p = new Packet(PACKET_CLIENT_DESYNC_LOG);
|
||||
size_t size = min<size_t>(log.size() - offset, SHRT_MAX - 2 - p->size);
|
||||
size_t size = std::min<size_t>(log.size() - offset, SHRT_MAX - 2 - p->size);
|
||||
p->Send_uint16(size);
|
||||
p->Send_binary(log.data() + offset, size);
|
||||
my_client->SendPacket(p);
|
||||
|
@@ -221,7 +221,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(uint count, const Con
|
||||
* A packet begins with the packet size and a byte for the type.
|
||||
* Then this packet adds a uint16 for the count in this packet.
|
||||
* The rest of the packet can be used for the IDs. */
|
||||
uint p_count = min(count, (SEND_MTU_SHORT - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32));
|
||||
uint p_count = std::min<uint>(count, (SEND_MTU_SHORT - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32));
|
||||
|
||||
Packet *p = new Packet(PACKET_CONTENT_CLIENT_INFO_ID);
|
||||
p->Send_uint16(p_count);
|
||||
@@ -247,14 +247,14 @@ void ClientNetworkContentSocketHandler::RequestContentList(ContentVector *cv, bo
|
||||
|
||||
this->Connect();
|
||||
|
||||
const uint max_per_packet = min<uint>(255, (SEND_MTU_SHORT - sizeof(PacketSize) - sizeof(byte) - sizeof(uint8)) /
|
||||
const uint max_per_packet = std::min<uint>(255, (SEND_MTU_SHORT - sizeof(PacketSize) - sizeof(byte) - sizeof(uint8)) /
|
||||
(sizeof(uint8) + sizeof(uint32) + (send_md5sum ? /*sizeof(ContentInfo::md5sum)*/16 : 0))) - 1;
|
||||
|
||||
uint offset = 0;
|
||||
|
||||
while (cv->size() > offset) {
|
||||
Packet *p = new Packet(send_md5sum ? PACKET_CONTENT_CLIENT_INFO_EXTID_MD5 : PACKET_CONTENT_CLIENT_INFO_EXTID);
|
||||
const uint to_send = min<uint>(cv->size() - offset, max_per_packet);
|
||||
const uint to_send = std::min<uint>(cv->size() - offset, max_per_packet);
|
||||
p->Send_uint8(to_send);
|
||||
|
||||
for (uint i = 0; i < to_send; i++) {
|
||||
@@ -370,7 +370,7 @@ void ClientNetworkContentSocketHandler::DownloadSelectedContentFallback(const Co
|
||||
* A packet begins with the packet size and a byte for the type.
|
||||
* Then this packet adds a uint16 for the count in this packet.
|
||||
* The rest of the packet can be used for the IDs. */
|
||||
uint p_count = min(count, (SEND_MTU_SHORT - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32));
|
||||
uint p_count = std::min<uint>(count, (SEND_MTU_SHORT - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32));
|
||||
|
||||
Packet *p = new Packet(PACKET_CONTENT_CLIENT_CONTENT);
|
||||
p->Send_uint16(p_count);
|
||||
@@ -750,6 +750,7 @@ public:
|
||||
void OnConnect(SOCKET s) override
|
||||
{
|
||||
assert(_network_content_client.sock == INVALID_SOCKET);
|
||||
_network_content_client.lastActivity = _realtime_tick;
|
||||
_network_content_client.isConnecting = false;
|
||||
_network_content_client.sock = s;
|
||||
_network_content_client.Reopen();
|
||||
@@ -762,8 +763,6 @@ public:
|
||||
*/
|
||||
void ClientNetworkContentSocketHandler::Connect()
|
||||
{
|
||||
this->lastActivity = _realtime_tick;
|
||||
|
||||
if (this->sock != INVALID_SOCKET || this->isConnecting) return;
|
||||
this->isConnecting = true;
|
||||
new NetworkContentConnecter(NetworkAddress(NETWORK_CONTENT_SERVER_HOST, NETWORK_CONTENT_SERVER_PORT, AF_UNSPEC));
|
||||
|
@@ -575,7 +575,7 @@ public:
|
||||
}
|
||||
|
||||
case WID_NCL_MATRIX:
|
||||
resize->height = max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
|
||||
resize->height = std::max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
|
||||
size->height = 10 * resize->height;
|
||||
break;
|
||||
}
|
||||
@@ -626,7 +626,7 @@ public:
|
||||
const NWidgetBase *nwi_name = this->GetWidget<NWidgetBase>(WID_NCL_NAME);
|
||||
const NWidgetBase *nwi_type = this->GetWidget<NWidgetBase>(WID_NCL_TYPE);
|
||||
|
||||
int line_height = max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL);
|
||||
int line_height = std::max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL);
|
||||
|
||||
/* Fill the matrix with the information */
|
||||
int sprite_y_offset = WD_MATRIX_TOP + (line_height - this->checkbox_size.height) / 2 - 1;
|
||||
@@ -877,7 +877,7 @@ public:
|
||||
break;
|
||||
case WKC_PAGEDOWN:
|
||||
/* scroll down a page */
|
||||
this->list_pos = min(this->list_pos + this->vscroll->GetCapacity(), (int)this->content.size() - 1);
|
||||
this->list_pos = std::min(this->list_pos + this->vscroll->GetCapacity(), (int)this->content.size() - 1);
|
||||
break;
|
||||
case WKC_HOME:
|
||||
/* jump to beginning */
|
||||
|
@@ -125,7 +125,7 @@ public:
|
||||
/* First initialise some variables... */
|
||||
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
|
||||
child_wid->SetupSmallestSize(w, init_array);
|
||||
this->smallest_y = max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom);
|
||||
this->smallest_y = std::max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom);
|
||||
}
|
||||
|
||||
/* ... then in a second pass make sure the 'current' sizes are set. Won't change for most widgets. */
|
||||
@@ -513,12 +513,12 @@ public:
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_NG_MATRIX:
|
||||
resize->height = WD_MATRIX_TOP + max(GetSpriteSize(SPR_BLOT).height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM;
|
||||
resize->height = WD_MATRIX_TOP + std::max(GetSpriteSize(SPR_BLOT).height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM;
|
||||
size->height = 12 * resize->height;
|
||||
break;
|
||||
|
||||
case WID_NG_LASTJOINED:
|
||||
size->height = WD_MATRIX_TOP + max(GetSpriteSize(SPR_BLOT).height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM;
|
||||
size->height = WD_MATRIX_TOP + std::max(GetSpriteSize(SPR_BLOT).height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM;
|
||||
break;
|
||||
|
||||
case WID_NG_LASTJOINED_SPACER:
|
||||
@@ -560,7 +560,7 @@ public:
|
||||
case WID_NG_MATRIX: {
|
||||
uint16 y = r.top;
|
||||
|
||||
const int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (int)this->servers.size());
|
||||
const int max = std::min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (int)this->servers.size());
|
||||
|
||||
for (int i = this->vscroll->GetPosition(); i < max; ++i) {
|
||||
const NetworkGameList *ngl = this->servers[i];
|
||||
@@ -827,7 +827,7 @@ public:
|
||||
case WKC_PAGEDOWN:
|
||||
/* scroll down a page */
|
||||
if (this->list_pos == SLP_INVALID) return ES_HANDLED;
|
||||
this->list_pos = min(this->list_pos + this->vscroll->GetCapacity(), (int)this->servers.size() - 1);
|
||||
this->list_pos = std::min(this->list_pos + this->vscroll->GetCapacity(), (int)this->servers.size() - 1);
|
||||
break;
|
||||
case WKC_HOME:
|
||||
/* jump to beginning */
|
||||
@@ -919,7 +919,7 @@ GUIGameServerList::FilterFunction * const NetworkGameWindow::filter_funcs[] = {
|
||||
|
||||
static NWidgetBase *MakeResizableHeader(int *biggest_index)
|
||||
{
|
||||
*biggest_index = max<int>(*biggest_index, WID_NG_INFO);
|
||||
*biggest_index = std::max<int>(*biggest_index, WID_NG_INFO);
|
||||
return new NWidgetServerListHeader();
|
||||
}
|
||||
|
||||
@@ -1876,13 +1876,13 @@ struct NetworkClientListWindow : Window {
|
||||
{
|
||||
if (widget != WID_CL_PANEL) return;
|
||||
|
||||
this->server_client_width = max(GetStringBoundingBox(STR_NETWORK_SERVER).width, GetStringBoundingBox(STR_NETWORK_CLIENT).width) + WD_FRAMERECT_RIGHT;
|
||||
this->server_client_width = std::max(GetStringBoundingBox(STR_NETWORK_SERVER).width, GetStringBoundingBox(STR_NETWORK_CLIENT).width) + WD_FRAMERECT_RIGHT;
|
||||
this->icon_size = GetSpriteSize(SPR_COMPANY_ICON);
|
||||
this->line_height = max(this->icon_size.height + 2U, (uint)FONT_HEIGHT_NORMAL);
|
||||
this->line_height = std::max(this->icon_size.height + 2U, (uint)FONT_HEIGHT_NORMAL);
|
||||
|
||||
uint width = 100; // Default width
|
||||
for (const NetworkClientInfo *ci : NetworkClientInfo::Iterate()) {
|
||||
width = max(width, GetStringBoundingBox(ci->client_name).width);
|
||||
width = std::max(width, GetStringBoundingBox(ci->client_name).width);
|
||||
}
|
||||
|
||||
size->width = WD_FRAMERECT_LEFT + this->server_client_width + this->icon_size.width + WD_FRAMERECT_LEFT + width + WD_FRAMERECT_RIGHT;
|
||||
@@ -2043,18 +2043,18 @@ struct NetworkJoinStatusWindow : Window {
|
||||
/* Account for the statuses */
|
||||
uint width = 0;
|
||||
for (uint i = 0; i < NETWORK_JOIN_STATUS_END; i++) {
|
||||
width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_1 + i).width);
|
||||
width = std::max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_1 + i).width);
|
||||
}
|
||||
|
||||
/* For the number of waiting (other) players */
|
||||
SetDParamMaxValue(0, MAX_CLIENTS);
|
||||
width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_WAITING).width);
|
||||
width = std::max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_WAITING).width);
|
||||
|
||||
/* Account for downloading ~ 10 MiB */
|
||||
SetDParamMaxDigits(0, 8);
|
||||
SetDParamMaxDigits(1, 8);
|
||||
width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_1).width);
|
||||
width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_2).width);
|
||||
width = std::max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_1).width);
|
||||
width = std::max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_2).width);
|
||||
|
||||
/* Give a bit more clearing for the widest strings than strictly needed */
|
||||
size->width = width + WD_FRAMERECT_LEFT + WD_FRAMERECT_BOTTOM + 10;
|
||||
|
@@ -167,7 +167,7 @@ struct PacketWriter : SaveFilter {
|
||||
|
||||
byte *bufe = buf + size;
|
||||
while (buf != bufe) {
|
||||
size_t to_write = min(SHRT_MAX - this->current->size, bufe - buf);
|
||||
size_t to_write = std::min<size_t>(SHRT_MAX - this->current->size, bufe - buf);
|
||||
memcpy(this->current->buffer + this->current->size, buf, to_write);
|
||||
this->current->size += (PacketSize)to_write;
|
||||
buf += to_write;
|
||||
@@ -475,7 +475,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendDesyncLog(const std::strin
|
||||
{
|
||||
for (size_t offset = 0; offset < log.size();) {
|
||||
Packet *p = new Packet(PACKET_SERVER_DESYNC_LOG);
|
||||
size_t size = min<size_t>(log.size() - offset, SHRT_MAX - 2 - p->size);
|
||||
size_t size = std::min<size_t>(log.size() - offset, SHRT_MAX - 2 - p->size);
|
||||
p->Send_uint16(size);
|
||||
p->Send_binary(log.data() + offset, size);
|
||||
this->SendPacket(p);
|
||||
@@ -1241,7 +1241,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_ERROR(Packet *p
|
||||
this->SendDesyncLog(server_desync_log);
|
||||
|
||||
// decrease the sync frequency for this point onwards
|
||||
_settings_client.network.sync_freq = min<uint16>(_settings_client.network.sync_freq, 16);
|
||||
_settings_client.network.sync_freq = std::min<uint16>(_settings_client.network.sync_freq, 16);
|
||||
|
||||
// have the server and all clients run some sanity checks
|
||||
NetworkSendCommand(0, 0, 0, 0, CMD_DESYNC_CHECK, nullptr, nullptr, _local_company, 0);
|
||||
@@ -1906,7 +1906,7 @@ void NetworkServer_Tick(bool send_frame)
|
||||
for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) {
|
||||
/* We allow a number of bytes per frame, but only to the burst amount
|
||||
* to be available for packet receiving at any particular time. */
|
||||
cs->receive_limit = min(cs->receive_limit + _settings_client.network.bytes_per_frame,
|
||||
cs->receive_limit = std::min<int>(cs->receive_limit + _settings_client.network.bytes_per_frame,
|
||||
_settings_client.network.bytes_per_frame_burst);
|
||||
|
||||
/* Check if the speed of the client is what we can expect from a client */
|
||||
|
@@ -336,7 +336,7 @@ void ServerNetworkUDPSocketHandler::Receive_CLIENT_GET_NEWGRFS(Packet *p, Networ
|
||||
* the current list and do not send the other data.
|
||||
* The name could be an empty string, if so take the filename. */
|
||||
size_t required_length = sizeof(info.ident.grfid) + sizeof(info.ident.md5sum) +
|
||||
min(strlen(info.name) + 1, (size_t)NETWORK_GRF_NAME_LENGTH);
|
||||
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
|
||||
flush_response();
|
||||
}
|
||||
|
Reference in New Issue
Block a user