summaryrefslogtreecommitdiff
path: root/station_cmd.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2005-04-16 20:10:24 +0000
committerDarkvater <darkvater@openttd.org>2005-04-16 20:10:24 +0000
commit878cebaa702bb9957d7393cda05c599dcad60419 (patch)
treed2fe7e17c73c519e549c66aa4fe9db5d6b880124 /station_cmd.c
parent0fa9c232257c2c786779e0840b28adebfccff4cd (diff)
downloadopenttd-878cebaa702bb9957d7393cda05c599dcad60419.tar.xz
(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.
Diffstat (limited to 'station_cmd.c')
-rw-r--r--station_cmd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/station_cmd.c b/station_cmd.c
index aac4b928a..8cecba027 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -1560,8 +1560,17 @@ static int32 RemoveRoadStop(Station *st, uint32 flags, TileIndex tile)
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;