summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2005-05-15 10:40:53 +0000
committerDarkvater <darkvater@openttd.org>2005-05-15 10:40:53 +0000
commit5501f25084e263acc7d82e40e3cb995ec43febbc (patch)
treebbb53793ee6f7ce1b6889b5f02e77b7685e24b7b
parent0ddf93956e5f3ccbf0620d613ad0698d1218c318 (diff)
downloadopenttd-5501f25084e263acc7d82e40e3cb995ec43febbc.tar.xz
(svn r2318) - Feature: added console command 'part' to leave a currently running game and 'join' which is an alias to 'connect' to join a multiplayer server.
-rw-r--r--console_cmds.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/console_cmds.c b/console_cmds.c
index 7ac82dc3d..d125a8f40 100644
--- a/console_cmds.c
+++ b/console_cmds.c
@@ -843,6 +843,19 @@ DEF_CONSOLE_CMD(ConExit)
return true;
}
+DEF_CONSOLE_CMD(ConPart)
+{
+ if (argc == 0) {
+ IConsoleHelp("Leave the currently joined/running game (only ingame). Usage: 'part'");
+ return true;
+ }
+
+ if (_game_mode != GM_NORMAL) return false;
+
+ _switch_mode = SM_MENU;
+ return true;
+}
+
DEF_CONSOLE_CMD(ConHelp)
{
if (argc == 2) {
@@ -1184,6 +1197,7 @@ void IConsoleStdLibRegister(void)
IConsoleCmdRegister("echoc", ConEchoC);
IConsoleCmdRegister("exec", ConExec);
IConsoleCmdRegister("exit", ConExit);
+ IConsoleCmdRegister("part", ConPart);
IConsoleCmdRegister("help", ConHelp);
IConsoleCmdRegister("info_cmd", ConInfoCmd);
IConsoleCmdRegister("info_var", ConInfoVar);
@@ -1227,6 +1241,7 @@ void IConsoleStdLibRegister(void)
IConsoleCmdHookAdd("reset_company", ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
IConsoleAliasRegister("clean_company", "reset_company %A");
IConsoleCmdRegister("connect", ConNetworkConnect);
+ IConsoleAliasRegister("join", "connect %A");
IConsoleCmdHookAdd("connect", ICONSOLE_HOOK_ACCESS, ConHookClientOnly);
IConsoleCmdRegister("clients", ConNetworkClients);
IConsoleCmdHookAdd("clients", ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork);