Merge branch 'master' into jgrpp

# Conflicts:
#	cmake/SourceList.cmake
#	src/build_vehicle_gui.cpp
#	src/company_gui.cpp
#	src/console_cmds.cpp
#	src/depot_base.h
#	src/elrail.cpp
#	src/network/core/udp.cpp
#	src/network/network_admin.cpp
#	src/network/network_chat_gui.cpp
#	src/network/network_gui.cpp
#	src/network/network_server.cpp
#	src/newgrf.cpp
#	src/newgrf_engine.cpp
#	src/newgrf_railtype.cpp
#	src/newgrf_railtype.h
#	src/newgrf_storage.h
#	src/os/unix/crashlog_unix.cpp
#	src/rail.h
#	src/rail_cmd.cpp
#	src/rail_gui.cpp
#	src/road_cmd.cpp
#	src/road_map.h
#	src/saveload/labelmaps_sl.cpp
#	src/settings_gui.cpp
#	src/settings_type.h
#	src/sl/oldloader_sl.cpp
#	src/station_cmd.cpp
#	src/station_gui.cpp
#	src/table/settings/world_settings.ini
#	src/tests/test_script_admin.cpp
#	src/textfile_gui.cpp
#	src/toolbar_gui.cpp
#	src/train_cmd.cpp
#	src/tunnelbridge_cmd.cpp
#	src/vehicle_gui.cpp
#	src/widget.cpp
#	src/window.cpp
#	src/window_gui.h
#	src/window_type.h
This commit is contained in:
Jonathan G Rennison
2023-11-19 12:19:17 +00:00
230 changed files with 2458 additions and 1106 deletions

View File

@@ -5,8 +5,8 @@ add_files(
config.h
core.cpp
core.h
game_info.cpp
game_info.h
network_game_info.cpp
network_game_info.h
host.cpp
host.h
http.h

View File

@@ -62,7 +62,7 @@ static const uint NETWORK_LONG_REVISION_LENGTH = 64; ///< The m
static const uint NETWORK_PASSWORD_LENGTH = 33; ///< The maximum length of the password, in bytes including '\0' (must be >= NETWORK_SERVER_ID_LENGTH)
static const uint NETWORK_CLIENT_NAME_LENGTH = 25; ///< The maximum length of a client's name, in bytes including '\0'
static const uint NETWORK_RCONCOMMAND_LENGTH = 500; ///< The maximum length of a rconsole command, in bytes including '\0'
static const uint NETWORK_GAMESCRIPT_JSON_LENGTH = COMPAT_MTU - 3; ///< The maximum length of a gamescript json string, in bytes including '\0'. Must not be longer than COMPAT_MTU including header (3 bytes)
static const uint NETWORK_GAMESCRIPT_JSON_LENGTH = 9000; ///< The maximum length of a receiving gamescript json string, in bytes including '\0'.
static const uint NETWORK_CHAT_LENGTH = 900; ///< The maximum length of a chat message, in bytes including '\0'
static const uint NETWORK_CONTENT_FILENAME_LENGTH = 48; ///< The maximum length of a content's filename, in bytes including '\0'.
static const uint NETWORK_CONTENT_NAME_LENGTH = 64; ///< The maximum length of a content's name, in bytes including '\0'.

View File

@@ -10,7 +10,7 @@
*/
#include "../../stdafx.h"
#include "game_info.h"
#include "network_game_info.h"
#include "../../core/bitmath_func.hpp"
#include "../../company_base.h"
#include "../../date_func.h"

View File

@@ -15,7 +15,7 @@
#include "os_abstraction.h"
#include "tcp.h"
#include "packet.h"
#include "game_info.h"
#include "network_game_info.h"
/**
* Enum with all types of TCP Game Coordinator packets. The order MUST not be changed.

View File

@@ -15,7 +15,7 @@
#include "os_abstraction.h"
#include "tcp.h"
#include "packet.h"
#include "game_info.h"
#include "network_game_info.h"
/** Enum with all types of TCP TURN packets. The order MUST not be changed. **/
enum PacketTurnType {

View File

@@ -10,7 +10,7 @@
#include "../stdafx.h"
#include "../strings_func.h"
#include "../date_func.h"
#include "core/game_info.h"
#include "core/network_game_info.h"
#include "network_admin.h"
#include "network_base.h"
#include "network_server.h"
@@ -22,6 +22,8 @@
#include "../rev.h"
#include "../game/game.hpp"
#include <numeric>
#include "../safeguards.h"
@@ -382,10 +384,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyEconomy()
{
for (const Company *company : Company::Iterate()) {
/* Get the income. */
Money income = 0;
for (uint i = 0; i < lengthof(company->yearly_expenses[0]); i++) {
income -= company->yearly_expenses[0][i];
}
Money income = -std::reduce(std::begin(company->yearly_expenses[0]), std::end(company->yearly_expenses[0]));
Packet *p = new Packet(ADMIN_PACKET_SERVER_COMPANY_ECONOMY);
@@ -556,11 +555,6 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendConsole(const std::string
*/
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendGameScript(const std::string_view json)
{
/* At the moment we cannot transmit anything larger than MTU. So we limit
* the maximum amount of json data that can be sent. Account also for
* the trailing \0 of the string */
if (json.size() + 1 >= NETWORK_GAMESCRIPT_JSON_LENGTH) return NETWORK_RECV_STATUS_OKAY;
Packet *p = new Packet(ADMIN_PACKET_SERVER_GAMESCRIPT);
p->Send_string(json);

View File

@@ -522,7 +522,7 @@ static WindowDesc _chat_window_desc(
WDP_MANUAL, nullptr, 0, 0,
WC_SEND_NETWORK_MSG, WC_NONE,
WDF_NETWORK,
_nested_chat_window_widgets, lengthof(_nested_chat_window_widgets)
std::begin(_nested_chat_window_widgets), std::end(_nested_chat_window_widgets)
);

View File

@@ -97,7 +97,7 @@ static WindowDesc _network_content_download_status_window_desc(
WDP_CENTER, nullptr, 0, 0,
WC_NETWORK_STATUS_WINDOW, WC_NONE,
WDF_MODAL,
_nested_network_content_download_status_window_widgets, lengthof(_nested_network_content_download_status_window_widgets)
std::begin(_nested_network_content_download_status_window_widgets), std::end(_nested_network_content_download_status_window_widgets)
);
BaseNetworkContentDownloadStatusWindow::BaseNetworkContentDownloadStatusWindow(WindowDesc *desc) :
@@ -1117,7 +1117,7 @@ static WindowDesc _network_content_list_desc(
WDP_CENTER, "list_content", 630, 460,
WC_NETWORK_WINDOW, WC_NONE,
0,
_nested_network_content_list_widgets, lengthof(_nested_network_content_list_widgets)
std::begin(_nested_network_content_list_widgets), std::end(_nested_network_content_list_widgets)
);
/**

View File

@@ -11,7 +11,7 @@
#define NETWORK_GAMELIST_H
#include "core/address.h"
#include "core/game_info.h"
#include "core/network_game_info.h"
#include "network_type.h"
/** The status a server can be in. */

View File

@@ -1030,7 +1030,7 @@ static WindowDesc _network_game_window_desc(
WDP_CENTER, "list_servers", 1000, 730,
WC_NETWORK_WINDOW, WC_NONE,
WDF_NETWORK,
_nested_network_game_widgets, lengthof(_nested_network_game_widgets)
std::begin(_nested_network_game_widgets), std::end(_nested_network_game_widgets)
);
void ShowNetworkGameWindow()
@@ -1303,7 +1303,7 @@ static WindowDesc _network_start_server_window_desc(
WDP_CENTER, nullptr, 0, 0,
WC_NETWORK_WINDOW, WC_NONE,
WDF_NETWORK,
_nested_network_start_server_window_widgets, lengthof(_nested_network_start_server_window_widgets)
std::begin(_nested_network_start_server_window_widgets), std::end(_nested_network_start_server_window_widgets)
);
static void ShowNetworkStartServerWindow()
@@ -1382,7 +1382,7 @@ static WindowDesc _client_list_desc(
WDP_AUTO, "list_clients", 220, 300,
WC_CLIENT_LIST, WC_NONE,
WDF_NETWORK,
_nested_client_list_widgets, lengthof(_nested_client_list_widgets)
std::begin(_nested_client_list_widgets), std::end(_nested_client_list_widgets)
);
/**
@@ -2297,7 +2297,7 @@ static WindowDesc _network_join_status_window_desc(
WDP_CENTER, nullptr, 0, 0,
WC_NETWORK_STATUS_WINDOW, WC_NONE,
WDF_MODAL | WDF_NETWORK,
_nested_network_join_status_window_widgets, lengthof(_nested_network_join_status_window_widgets)
std::begin(_nested_network_join_status_window_widgets), std::end(_nested_network_join_status_window_widgets)
);
void ShowJoinStatusWindow()
@@ -2419,7 +2419,7 @@ static WindowDesc _network_company_password_window_desc(
WDP_AUTO, nullptr, 0, 0,
WC_COMPANY_PASSWORD_WINDOW, WC_NONE,
WDF_NETWORK,
_nested_network_company_password_window_widgets, lengthof(_nested_network_company_password_window_widgets)
std::begin(_nested_network_company_password_window_widgets), std::end(_nested_network_company_password_window_widgets)
);
void ShowNetworkCompanyPasswordWindow(Window *parent)
@@ -2522,7 +2522,7 @@ static WindowDesc _network_ask_relay_desc(
WDP_CENTER, nullptr, 0, 0,
WC_NETWORK_ASK_RELAY, WC_NONE,
WDF_MODAL | WDF_NETWORK,
_nested_network_ask_relay_widgets, lengthof(_nested_network_ask_relay_widgets)
std::begin(_nested_network_ask_relay_widgets), std::end(_nested_network_ask_relay_widgets)
);
/**
@@ -2620,7 +2620,7 @@ static WindowDesc _network_ask_survey_desc(
WDP_CENTER, nullptr, 0, 0,
WC_NETWORK_ASK_SURVEY, WC_NONE,
WDF_MODAL,
_nested_network_ask_survey_widgets, lengthof(_nested_network_ask_survey_widgets)
std::begin(_nested_network_ask_survey_widgets), std::end(_nested_network_ask_survey_widgets)
);
/**

View File

@@ -8,7 +8,7 @@
/** @file network_query.cpp Query part of the network protocol. */
#include "../stdafx.h"
#include "core/game_info.h"
#include "core/network_game_info.h"
#include "network_query.h"
#include "network_gamelist.h"
#include "../error.h"

View File

@@ -10,7 +10,7 @@
#include "../stdafx.h"
#include "../strings_func.h"
#include "../date_func.h"
#include "core/game_info.h"
#include "core/network_game_info.h"
#include "network_admin.h"
#include "network_server.h"
#include "network_udp.h"

View File

@@ -16,7 +16,7 @@
#include "../date_func.h"
#include "../map_func.h"
#include "../debug.h"
#include "core/game_info.h"
#include "core/network_game_info.h"
#include "network_gamelist.h"
#include "network_internal.h"
#include "network_udp.h"