From 4cdc253c38fe7378e2e9cf0ff58bf2e4bc0baa68 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 27 Mar 2018 17:51:45 +0100 Subject: [PATCH] Add dev console command to trigger disaster --- src/console_cmds.cpp | 14 ++++++++++++++ src/disaster_vehicle.cpp | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index e22fb5da26..c6cca74fb6 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -2010,6 +2010,19 @@ DEF_CONSOLE_CMD(ConCheckCaches) return true; } +DEF_CONSOLE_CMD(ConDoDisaster) +{ + if (argc == 0) { + IConsoleHelp("Debug: Do disaster"); + return true; + } + + extern void DoDisaster(); + DoDisaster(); + + return true; +} + #ifdef _DEBUG /****************** * debug commands @@ -2161,6 +2174,7 @@ void IConsoleStdLibRegister() /* NewGRF development stuff */ IConsoleCmdRegister("reload_newgrfs", ConNewGRFReload, ConHookNewGRFDeveloperTool); + IConsoleCmdRegister("do_disaster", ConDoDisaster, ConHookNewGRFDeveloperTool, true); /* Bug workarounds */ IConsoleCmdRegister("jgrpp_bug_workaround_unblock_heliports", ConResetBlockedHeliports, ConHookNoNetwork, true); diff --git a/src/disaster_vehicle.cpp b/src/disaster_vehicle.cpp index 647fed51ce..3892c7f882 100644 --- a/src/disaster_vehicle.cpp +++ b/src/disaster_vehicle.cpp @@ -905,7 +905,7 @@ static const Disaster _disasters[] = { {Disaster_CoalMine_Init, 1950, 1985}, // coalmine }; -static void DoDisaster() +void DoDisaster() { byte buf[lengthof(_disasters)];