diff options
author | celestar <celestar@openttd.org> | 2006-03-02 08:55:12 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2006-03-02 08:55:12 +0000 |
commit | 9d54e51ef995d2f2d65b12f74ce31cbcbf8848a1 (patch) | |
tree | e514578eea81526bce27d2306272f84907b34d4f /console_cmds.c | |
parent | 841e6ab121d1f2d29904e8408b0394c55cbf17f5 (diff) | |
download | openttd-9d54e51ef995d2f2d65b12f74ce31cbcbf8848a1.tar.xz |
(svn r3730) Multistop modifications:
-Codechange: Completely rewritten the slot assignment system. It now consumes less CPU cycles and memory
-Codechange: Increased maximum number of roadstops to 16.
-Fix: Several conditions where a slot becomes unliked from a vehicle
-Codechange: ClearSlot now only takes one parameter, the vehicle
-Feature: Console command 'clearslots' to clear ALL currently assinged slots. debug usage only
-Feature: vehicles that cannot get a slot now wait on the road instead of planlessly blocking stops or circling around
-Codechange: Adjusted debug levels
TODO: Make the slot finder compatible with (a) pathfinder(s).
Diffstat (limited to 'console_cmds.c')
-rw-r--r-- | console_cmds.c | 25 |
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"); |