summaryrefslogtreecommitdiff
path: root/src/console_cmds.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-03-24 20:47:03 +0000
committerfrosch <frosch@openttd.org>2010-03-24 20:47:03 +0000
commit03249ebcfbcf4a73a4e2acc302a89e0878fdb5ec (patch)
treeb202b89cbe1a190e37788ca28723dd15ae9bf9f3 /src/console_cmds.cpp
parent9a00f6961fa0cf9d4a60c4253b68d740f95c303b (diff)
downloadopenttd-03249ebcfbcf4a73a4e2acc302a89e0878fdb5ec.tar.xz
(svn r19515) -Add: Client setting 'gui.newgrf_developer_tools' to enable otherwise hidden features.
-Add: Console command 'reload_newgrfs'; only available when newgrf developer tools are enabled.
Diffstat (limited to 'src/console_cmds.cpp')
-rw-r--r--src/console_cmds.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 6899fd3fc..7a55d01e0 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -34,6 +34,7 @@
#include "gamelog.h"
#include "ai/ai.hpp"
#include "ai/ai_config.hpp"
+#include "newgrf.h"
#include "console_func.h"
#ifdef ENABLE_NETWORK
@@ -110,6 +111,22 @@ DEF_CONSOLE_HOOK(ConHookNoNetwork)
# define ConHookNoNetwork NULL
#endif /* ENABLE_NETWORK */
+DEF_CONSOLE_HOOK(ConHookNewGRFDeveloperTool)
+{
+ if (_settings_client.gui.newgrf_developer_tools) {
+ if (_game_mode == GM_MENU) {
+ if (echo) IConsoleError("This command is only available in game and editor.");
+ return CHR_DISALLOW;
+ }
+#ifdef ENABLE_NETWORK
+ return ConHookNoNetwork(echo);
+#else
+ return CHR_ALLOW;
+#endif
+ }
+ return CHR_HIDE;
+}
+
static void IConsoleHelp(const char *str)
{
IConsolePrintF(CC_WARNING, "- %s", str);
@@ -1686,6 +1703,17 @@ DEF_CONSOLE_CMD(ConGamelogPrint)
return true;
}
+DEF_CONSOLE_CMD(ConNewGRFReload)
+{
+ if (argc == 0) {
+ IConsoleHelp("Reloads all active NewGRFs from disk. Equivalent to reapplying NewGRFs via the settings, but without asking for confirmation. This might crash OpenTTD!");
+ return true;
+ }
+
+ ReloadNewGRFData();
+ return true;
+}
+
#ifdef _DEBUG
/******************
* debug commands
@@ -1826,4 +1854,7 @@ void IConsoleStdLibRegister()
#ifdef _DEBUG
IConsoleDebugLibRegister();
#endif
+
+ /* NewGRF development stuff */
+ IConsoleCmdRegister("reload_newgrfs", ConNewGRFReload, ConHookNewGRFDeveloperTool);
}