summaryrefslogtreecommitdiff
path: root/console_cmds.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-03-02 08:55:12 +0000
committercelestar <celestar@openttd.org>2006-03-02 08:55:12 +0000
commitdb4777c818caf8c07779f6a4e073c87e1049b100 (patch)
treee514578eea81526bce27d2306272f84907b34d4f /console_cmds.c
parentaf08671127e68b68f149c4dbad2d196f0e649cad (diff)
downloadopenttd-db4777c818caf8c07779f6a4e073c87e1049b100.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.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");