(svn r2210) - Fix: When a road-station is deleted, also delete the assigned slots of all vehicles headed to that station. This fixes an assertion, thanks go to Tron for finding the cause.
authorDarkvater
Sat, 16 Apr 2005 20:10:24 +0000
changeset 1706 6f78a98f676d
parent 1705 4ea793da2522
child 1707 6e622b242334
(svn r2210) - Fix: When a road-station is deleted, also delete the assigned slots of all vehicles headed to that station. This fixes an assertion, thanks go to Tron for finding the cause.
station_cmd.c
--- a/station_cmd.c	Sat Apr 16 18:09:24 2005 +0000
+++ b/station_cmd.c	Sat Apr 16 20:10:24 2005 +0000
@@ -1560,8 +1560,17 @@
 		return CMD_ERROR;
 
 	if (flags & DC_EXEC) {
+		int i;
 		DoClearSquare(tile);
 
+		/* Clear all vehicles destined for this station */
+		for (i = 0; i != NUM_SLOTS; i++) {
+			if (cur_stop->slot[i] != INVALID_SLOT) {
+				Vehicle *v = GetVehicle(cur_stop->slot[i]);
+				ClearSlot(v, v->u.road.slot);
+			}
+		}
+
 		cur_stop->used = false;
 		if (cur_stop->prev != NULL)	//alter previous stop
 			cur_stop->prev->next = cur_stop->next;