(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).
This commit is contained in:
celestar
2006-03-02 08:55:12 +00:00
parent 841e6ab121
commit 9d54e51ef9
6 changed files with 134 additions and 85 deletions

View File

@@ -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");