summaryrefslogtreecommitdiff
path: root/console_cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'console_cmds.c')
-rw-r--r--console_cmds.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/console_cmds.c b/console_cmds.c
index d150b2264..a698df3e4 100644
--- a/console_cmds.c
+++ b/console_cmds.c
@@ -17,6 +17,7 @@
#include "settings.h"
#include "hal.h" /* for file list */
#include "vehicle.h"
+#include "station.h"
// ** scriptfile handling ** //
static FILE *_script_file;
@@ -91,6 +92,29 @@ static void IConsoleHelp(const char *str)
IConsolePrintF(_icolour_warn, "- %s", str);
}
+DEF_CONSOLE_CMD(ConResetSlots)
+{
+ Vehicle *v;
+ RoadStop *rs;
+ if (argc == 0) {
+ IConsoleHelp("Resets all slots in the game. For debugging only. Usage: 'clearslots'");
+ return true;
+ }
+
+ FOR_ALL_VEHICLES(v) {
+ if (IsValidVehicle(v)) {
+ if (v->type == VEH_Road)
+ ClearSlot(v);
+ }
+ }
+
+ FOR_ALL_ROADSTOPS(rs) {
+ rs->slot[0] = rs->slot[1] = INVALID_VEHICLE;
+ }
+
+ return true;
+}
+
DEF_CONSOLE_CMD(ConStopAllVehicles)
{
Vehicle* v;
@@ -1364,6 +1388,7 @@ void IConsoleStdLibRegister(void)
IConsoleCmdRegister("cd", ConChangeDirectory);
IConsoleCmdRegister("pwd", ConPrintWorkingDirectory);
IConsoleCmdRegister("clear", ConClearBuffer);
+ IConsoleCmdRegister("clearslots", ConResetSlots);
IConsoleCmdRegister("stopall", ConStopAllVehicles);
IConsoleAliasRegister("dir", "ls");