summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-01-13 01:39:22 +0000
committerrubidium <rubidium@openttd.org>2008-01-13 01:39:22 +0000
commit079abbd04be8e997a0d09eb89ad03884a4e12d00 (patch)
tree991113cabdf8f73af8334d2f01990b558f897f8b /src
parentd4e6a6bf57216b39745b61971141e088e15e2d0d (diff)
downloadopenttd-079abbd04be8e997a0d09eb89ad03884a4e12d00.tar.xz
(svn r11829) -Feature: allow reloading openttd.cfg when starting a new game on a dedicated server. Patch by dihedral.
Diffstat (limited to 'src')
-rw-r--r--src/console_cmds.cpp2
-rw-r--r--src/network/network.cpp2
-rw-r--r--src/network/network.h1
-rw-r--r--src/openttd.cpp7
-rw-r--r--src/settings.cpp1
5 files changed, 13 insertions, 0 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 516bcad1a..c69870dd5 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -1652,6 +1652,8 @@ void IConsoleStdLibRegister()
IConsoleVarRegister("min_players", &_network_min_players, ICONSOLE_VAR_BYTE, "Automatically pause the game when the number of active players passes below the given amount");
IConsoleVarHookAdd("min_players", ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
IConsoleVarHookAdd("min_players", ICONSOLE_HOOK_POST_ACTION, ConHookCheckMinPlayers);
+ IConsoleVarRegister("reload_cfg", &_network_reload_cfg, ICONSOLE_VAR_BOOLEAN, "reload the entire config file between the end of this game, and starting the next new game - dedicated servers");
+ IConsoleVarHookAdd("reload_cfg", ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
#endif /* ENABLE_NETWORK */
diff --git a/src/network/network.cpp b/src/network/network.cpp
index 7040a4d71..e24da5053 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -38,6 +38,8 @@ extern const char _openttd_revision[];
#include "table/strings.h"
+bool _network_reload_cfg;
+
/* Check whether NETWORK_NUM_LANDSCAPES is still in sync with NUM_LANDSCAPE */
assert_compile((int)NETWORK_NUM_LANDSCAPES == (int)NUM_LANDSCAPE);
diff --git a/src/network/network.h b/src/network/network.h
index 7fd551704..98064dad0 100644
--- a/src/network/network.h
+++ b/src/network/network.h
@@ -211,6 +211,7 @@ VARDEF bool _network_server; ///< network-server is active
VARDEF bool _network_available; ///< is network mode available?
VARDEF bool _network_dedicated; ///< are we a dedicated server?
VARDEF bool _network_advertise; ///< is the server advertising to the master server?
+extern bool _network_reload_cfg; ///< will we reload the entire config for the next game?
#else /* ENABLE_NETWORK */
/* Network function stubs when networking is disabled */
diff --git a/src/openttd.cpp b/src/openttd.cpp
index c3ee5e035..6df99dba1 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -843,6 +843,13 @@ void SwitchMode(int new_mode)
if (_is_network_server) {
/* But not if we are going to the menu */
if (new_mode != SM_MENU) {
+ /* check if we should reload the config */
+ if (_network_reload_cfg) {
+ LoadFromConfig();
+ _patches = _patches_newgame;
+ _opt = _opt_newgame;
+ ResetGRFConfig(false);
+ }
NetworkServerStart();
} else {
/* This client no longer wants to be a network-server */
diff --git a/src/settings.cpp b/src/settings.cpp
index 0fa495fa7..d077f1ab9 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1307,6 +1307,7 @@ static const SettingDescGlobVarList _network_settings[] = {
SDTG_VAR("restart_game_year", SLE_INT32, S,D0, _network_restart_game_year, 0, MIN_YEAR, MAX_YEAR, 1, STR_NULL, NULL),
SDTG_VAR("min_players", SLE_UINT8, S, 0, _network_min_players, 0, 0, 10, 0, STR_NULL, NULL),
SDTG_OMANY("server_lang", SLE_UINT8, S, 0, _network_game_info.server_lang, 0, 28, "ANY|ENGLISH|GERMAN|FRENCH|BRAZILIAN|BULGARIAN|CHINESE|CZECH|DANISH|DUTCH|ESPERANTO|FINNISH|HUNGARIAN|ICELANDIC|ITALIAN|JAPANESE|KOREAN|LITHUANIAN|NORWEGIAN|POLISH|PORTUGUESE|ROMANIAN|RUSSIAN|SLOVAK|SLOVENIAN|SPANISH|SWEDISH|TURKISH|UKRAINIAN", STR_NULL, NULL),
+ SDTG_BOOL("reload_cfg", S, 0, _network_reload_cfg, false, STR_NULL, NULL),
SDTG_END()
};
#endif /* ENABLE_NETWORK */