Merge branch 'master' into jgrpp-beta

# Conflicts:
#	.github/workflows/commit-checker.yml
#	src/company_cmd.cpp
#	src/console_cmds.cpp
#	src/crashlog.cpp
#	src/lang/english.txt
#	src/lang/german.txt
#	src/lang/indonesian.txt
#	src/lang/japanese.txt
#	src/lang/korean.txt
#	src/lang/swedish.txt
#	src/linkgraph/linkgraphjob.cpp
#	src/linkgraph/mcf.cpp
#	src/network/core/tcp.cpp
#	src/network/core/tcp.h
#	src/network/core/tcp_game.h
#	src/network/core/udp.h
#	src/network/network.cpp
#	src/network/network_admin.cpp
#	src/network/network_admin.h
#	src/network/network_chat_gui.cpp
#	src/network/network_client.cpp
#	src/network/network_client.h
#	src/network/network_func.h
#	src/network/network_internal.h
#	src/network/network_server.cpp
#	src/network/network_server.h
#	src/newgrf.cpp
#	src/newgrf_station.cpp
#	src/order_gui.cpp
#	src/rail_cmd.cpp
#	src/saveload/saveload.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/settings_internal.h
#	src/settings_type.h
#	src/station_cmd.cpp
#	src/stdafx.h
#	src/table/currency_settings.ini
#	src/table/misc_settings.ini
#	src/table/settings.h.preamble
#	src/table/settings.ini
#	src/terraform_cmd.cpp
#	src/timetable_gui.cpp
#	src/train_cmd.cpp
#	src/tree_cmd.cpp
#	src/water_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2021-09-27 22:47:13 +01:00
204 changed files with 1829 additions and 1549 deletions

View File

@@ -553,23 +553,19 @@ void OpenBrowser(const char *url)
/** Callback structure of statements to be executed after the NewGRF scan. */
struct AfterNewGRFScan : NewGRFScanCallback {
Year startyear; ///< The start year.
uint32 generation_seed; ///< Seed for the new game.
std::string dedicated_host; ///< Hostname for the dedicated server.
uint16 dedicated_port; ///< Port for the dedicated server.
char *network_conn; ///< Information about the server to connect to, or nullptr.
const char *join_server_password; ///< The password to join the server with.
const char *join_company_password; ///< The password to join the company with.
bool save_config; ///< The save config setting.
Year startyear = INVALID_YEAR; ///< The start year.
uint32 generation_seed = GENERATE_NEW_SEED; ///< Seed for the new game.
std::string dedicated_host; ///< Hostname for the dedicated server.
uint16 dedicated_port = 0; ///< Port for the dedicated server.
std::string connection_string; ///< Information about the server to connect to
std::string join_server_password; ///< The password to join the server with.
std::string join_company_password; ///< The password to join the company with.
bool save_config = true; ///< The save config setting.
/**
* Create a new callback.
*/
AfterNewGRFScan() :
startyear(INVALID_YEAR), generation_seed(GENERATE_NEW_SEED),
dedicated_port(0), network_conn(nullptr),
join_server_password(nullptr), join_company_password(nullptr),
save_config(true)
AfterNewGRFScan()
{
/* Visual C++ 2015 fails compiling this line (AfterNewGRFScan::generation_seed undefined symbol)
* if it's placed outside a member function, directly in the struct body. */
@@ -622,11 +618,11 @@ struct AfterNewGRFScan : NewGRFScanCallback {
/* Make sure _settings is filled with _settings_newgame if we switch to a game directly */
if (_switch_mode != SM_NONE) MakeNewgameSettingsLive();
if (_network_available && network_conn != nullptr) {
if (_network_available && !connection_string.empty()) {
LoadIntroGame();
_switch_mode = SM_NONE;
NetworkClientConnectGame(network_conn, COMPANY_NEW_COMPANY, join_server_password, join_company_password);
NetworkClientConnectGame(connection_string, COMPANY_NEW_COMPANY, join_server_password, join_company_password);
}
/* After the scan we're not used anymore. */
@@ -725,7 +721,7 @@ int openttd_main(int argc, char *argv[])
break;
case 'f': _dedicated_forks = true; break;
case 'n':
scanner->network_conn = mgo.opt; // optional IP parameter, nullptr if unset
scanner->connection_string = mgo.opt; // optional IP:port#company parameter
break;
case 'l':
debuglog_conn = mgo.opt;
@@ -1055,7 +1051,7 @@ static void MakeNewGameDone()
/* We are the server, we start a new company (not dedicated),
* so set the default password *if* needed. */
if (_network_server && !StrEmpty(_settings_client.network.default_company_pass)) {
if (_network_server && !_settings_client.network.default_company_pass.empty()) {
NetworkChangeCompanyPassword(_local_company, _settings_client.network.default_company_pass);
}
@@ -1173,7 +1169,7 @@ bool SafeLoad(const std::string &filename, SaveLoadOperation fop, DetailedFileTy
void SwitchToMode(SwitchMode new_mode)
{
/* If we are saving something, the network stays in his current state */
/* If we are saving something, the network stays in its current state */
if (new_mode != SM_SAVE_GAME) {
/* If the network is active, make it not-active */
if (_networking) {