summaryrefslogtreecommitdiff
path: root/src/console_cmds.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-01-28 23:17:28 +0000
committeryexo <yexo@openttd.org>2010-01-28 23:17:28 +0000
commitd75b9f1642f24dd3336437d818b41c2a6d295905 (patch)
treedb80d07dbbae17ffbfbb6507256a33d4db4a2905 /src/console_cmds.cpp
parentfa01b25f740d92ffa74de4bc630ca42cdc8046a0 (diff)
downloadopenttd-d75b9f1642f24dd3336437d818b41c2a6d295905.tar.xz
(svn r18943) -Feature [FS#2885]: make it possible to change newgame settings from within a game via the console (use setting_newgame instead of setting)
Diffstat (limited to 'src/console_cmds.cpp')
-rw-r--r--src/console_cmds.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 6e50b50db..fd74b0c89 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -1713,6 +1713,25 @@ DEF_CONSOLE_CMD(ConSetting)
return true;
}
+DEF_CONSOLE_CMD(ConSettingNewgame)
+{
+ if (argc == 0) {
+ IConsoleHelp("Change setting for the next game. Usage: 'setting_newgame <name> [<value>]'");
+ IConsoleHelp("Omitting <value> will print out the current value of the setting.");
+ return true;
+ }
+
+ if (argc == 1 || argc > 3) return false;
+
+ if (argc == 2) {
+ IConsoleGetSetting(argv[1], true);
+ } else {
+ IConsoleSetSetting(argv[1], argv[2], true);
+ }
+
+ return true;
+}
+
DEF_CONSOLE_CMD(ConListSettings)
{
if (argc == 0) {
@@ -1818,6 +1837,7 @@ void IConsoleStdLibRegister()
IConsoleCmdRegister("pwd", ConPrintWorkingDirectory);
IConsoleCmdRegister("clear", ConClearBuffer);
IConsoleCmdRegister("setting", ConSetting);
+ IConsoleCmdRegister("setting_newgame", ConSettingNewgame);
IConsoleCmdRegister("list_settings",ConListSettings);
IConsoleCmdRegister("gamelog", ConGamelogPrint);
@@ -1828,6 +1848,7 @@ void IConsoleStdLibRegister()
IConsoleAliasRegister("new_game", "newgame");
IConsoleAliasRegister("patch", "setting %+");
IConsoleAliasRegister("set", "setting %+");
+ IConsoleAliasRegister("set_newgame", "setting_newgame %+");
IConsoleAliasRegister("list_patches", "list_settings %+");