(svn r4323) -Regression: Clear the slot assignments of all vehicles heading twoards a road stop if that road stop gets removed
authortron
Sat, 08 Apr 2006 13:32:38 +0000
changeset 3478 ff1ee5617a58
parent 3477 4a686a43af8a
child 3479 3655a074a380
(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.
station_cmd.c
--- a/station_cmd.c	Sat Apr 08 12:04:23 2006 +0000
+++ b/station_cmd.c	Sat Apr 08 13:32:38 2006 +0000
@@ -1410,6 +1410,18 @@
 	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;