From 40a9b91b37ecac9aad66d1deeca4c6ad2cff1f7f Mon Sep 17 00:00:00 2001 From: truelight Date: Tue, 29 Mar 2005 19:10:13 +0000 Subject: (svn r2106) -Fix: improved the network-join algoritm, it is now a bit more stable -Add: added 'pause_on_join' and 'max_join_time' for MP games, where you can auto-pause the game when a client wants to join the game. This to avoid connection losses because of big maps (200+ trains). (with tnx to #openttdcoop for the ideas and testing) --- console_cmds.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'console_cmds.c') diff --git a/console_cmds.c b/console_cmds.c index 809808c3a..88b7bb3c2 100644 --- a/console_cmds.c +++ b/console_cmds.c @@ -436,6 +436,9 @@ DEF_CONSOLE_CMD(ConStatus) case STATUS_AUTH: status = "authorized"; break; + case STATUS_MAP_WAIT: + status = "waiting"; + break; case STATUS_MAP: status = "loading map"; break; @@ -1061,6 +1064,20 @@ DEF_CONSOLE_CMD(ConSet) { return NULL; } + // setting max-join-time + if (strcmp(argv[1],"max_join_time") == 0) { + if (argc == 3 && atoi(argv[2]) != 0) { + _network_max_join_time = atoi(argv[2]); + IConsolePrintF(_iconsole_color_warning, "Max-join-time changed to '%d'", _network_max_join_time); + IConsolePrintF(_iconsole_color_warning, "Changes will take effect immediatly."); + } else { + IConsolePrintF(_iconsole_color_default, "Current max-join-time is '%d'", _network_max_join_time); + IConsolePrint(_iconsole_color_warning, "Usage: set max_join_time (default = 500)."); + } + return NULL; + } + + // setting the server advertising on/off if (strcmp(argv[1],"server_advertise") == 0) { if (!_network_server) { @@ -1082,6 +1099,25 @@ DEF_CONSOLE_CMD(ConSet) { return NULL; } + // setting the server 'pause on client join' on/off + if (strcmp(argv[1],"pause_on_join") == 0) { + if (!_network_server) { + IConsolePrintF(_iconsole_color_error, "You are not the server"); + return NULL; + } + if (argc == 3) { + if (strcmp(argv[2], "on") == 0 || atoi(argv[2]) == 1) + _network_pause_on_join = true; + else + _network_pause_on_join = false; + IConsolePrintF(_iconsole_color_warning, "Pause-on-join changed to '%s'", (_network_pause_on_join)?"on":"off"); + } else { + IConsolePrintF(_iconsole_color_default, "Current pause-on-join is '%s'", (_network_pause_on_join)?"on":"off"); + IConsolePrint(_iconsole_color_warning, "Usage: set pause_on_join on/off."); + } + return NULL; + } + // setting the server autoclean on/off if (strcmp(argv[1],"autoclean_companies") == 0) { if (!_network_server) { @@ -1175,7 +1211,9 @@ DEF_CONSOLE_CMD(ConSet) { IConsolePrint(_iconsole_color_error, " - autoclean_protected "); IConsolePrint(_iconsole_color_error, " - autoclean_unprotected "); IConsolePrint(_iconsole_color_error, " - company_pw \"\""); + IConsolePrint(_iconsole_color_error, " - max_join_time "); IConsolePrint(_iconsole_color_error, " - name \"\""); + IConsolePrint(_iconsole_color_error, " - pause_on_join on/off"); IConsolePrint(_iconsole_color_error, " - rcon_pw \"\""); IConsolePrint(_iconsole_color_error, " - server_name \"\""); IConsolePrint(_iconsole_color_error, " - server_advertise on/off"); -- cgit v1.2.3-54-g00ecf