summaryrefslogtreecommitdiff
path: root/ai
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2006-10-31 17:13:12 +0000
committerglx <glx@openttd.org>2006-10-31 17:13:12 +0000
commit993cb13c8dde55d77b732bba55bf3c94b0ea9216 (patch)
tree768530db6d2f593ca3f9ec46e8dbaacb046df9d1 /ai
parent6f74ef3a5359233d58044bb89a6efbf1edbc369f (diff)
downloadopenttd-993cb13c8dde55d77b732bba55bf3c94b0ea9216.tar.xz
(svn r7020) -Fix r6047: AI tries to delete stations that are 'in use' because FOR_ALL_STATIONS skips invalid stations
Diffstat (limited to 'ai')
-rw-r--r--ai/default/default.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/ai/default/default.c b/ai/default/default.c
index dc4cce2fa..b78abb5ac 100644
--- a/ai/default/default.c
+++ b/ai/default/default.c
@@ -3555,7 +3555,6 @@ static void AiStateRemoveStation(Player *p)
{
// Remove stations that aren't in use by any vehicle
byte *in_use;
- const byte *used;
const Order *ord;
const Station *st;
TileIndex tile;
@@ -3571,9 +3570,8 @@ static void AiStateRemoveStation(Player *p)
}
// Go through all stations and delete those that aren't in use
- used = in_use;
FOR_ALL_STATIONS(st) {
- if (st->owner == _current_player && !*used &&
+ if (st->owner == _current_player && !in_use[st->index] &&
( (st->bus_stops != NULL && (tile = st->bus_stops->xy) != 0) ||
(st->truck_stops != NULL && (tile = st->truck_stops->xy)) != 0 ||
(tile = st->train_tile) != 0 ||
@@ -3581,7 +3579,6 @@ static void AiStateRemoveStation(Player *p)
(tile = st->airport_tile) != 0)) {
DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
}
- used++;
}
free(in_use);