diff options
author | peter1138 <peter1138@openttd.org> | 2006-10-03 16:15:34 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-10-03 16:15:34 +0000 |
commit | 53744881a409f3d1624d0e60e3823370a3900cbe (patch) | |
tree | 482f18a4ccfe72d4d8e699b988e5e3ef336eaf86 /console_cmds.c | |
parent | 950ef8f2373a2bf561d256f42c07606c3ce00854 (diff) | |
download | openttd-53744881a409f3d1624d0e60e3823370a3900cbe.tar.xz |
(svn r6628) - Feature: Add the ability to pause a server if not enough players are connected. The setting for this is 'min_players' and can be set in the config and via the console. If the number of players drops below this number, the server will pause the game.
Diffstat (limited to 'console_cmds.c')
-rw-r--r-- | console_cmds.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/console_cmds.c b/console_cmds.c index 37b7d92a6..39f34cfb2 100644 --- a/console_cmds.c +++ b/console_cmds.c @@ -612,6 +612,12 @@ DEF_CONSOLE_HOOK(ConHookValidateMaxSpectatorsCount) return true; } +DEF_CONSOLE_HOOK(ConHookCheckMinPlayers) +{ + CheckMinPlayers(); + return true; +} + DEF_CONSOLE_CMD(ConKick) { NetworkClientInfo *ci; @@ -1580,6 +1586,10 @@ void IConsoleStdLibRegister(void) IConsoleVarRegister("restart_game_year", &_network_restart_game_year, ICONSOLE_VAR_UINT16, "Auto-restart the server when Jan 1st of the set year is reached. Use '0' to disable this"); IConsoleVarHookAdd("restart_game_year", ICONSOLE_HOOK_ACCESS, ConHookServerOnly); + 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); + #endif /* ENABLE_NETWORK */ // debugging stuff |