summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-04-08 13:32:38 +0000
committertron <tron@openttd.org>2006-04-08 13:32:38 +0000
commitda60a82021a4e07d2d29b06d0989a72efa5ff718 (patch)
tree6a57eea6597dc6409cb4d67ba6fd91794c47b883
parentffadd91ca9fc5de831eb68a4303852790efa6d41 (diff)
downloadopenttd-da60a82021a4e07d2d29b06d0989a72efa5ff718.tar.xz
(svn r4323) -Regression: Clear the slot assignments of all vehicles heading twoards a road stop if that road stop gets removed
This issue was fixed in r2210 and reintroduced in r4259 when the multistop handling was overhauled.
-rw-r--r--station_cmd.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/station_cmd.c b/station_cmd.c
index 7cdc82c04..0a7c4724f 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -1410,6 +1410,18 @@ static int32 RemoveRoadStop(Station *st, uint32 flags, TileIndex tile)
if (!EnsureNoVehicle(tile)) return CMD_ERROR;
if (flags & DC_EXEC) {
+ Vehicle* v;
+
+ /* Clear the slot assignment of all vehicles heading for this road stop */
+ if (cur_stop->num_vehicles != 0) {
+ FOR_ALL_VEHICLES(v) {
+ if (v->type == VEH_Road && v->u.road.slot == cur_stop) {
+ ClearSlot(v);
+ }
+ }
+ }
+ assert(cur_stop->num_vehicles == 0);
+
DoClearSquare(tile);
cur_stop->used = false;