# HG changeset patch # User glx # Date 1162314792 0 # Node ID 2d11c27a8492f4babb14ed4f164fd1739cda9c92 # Parent 7ff1e87d59b917cefad6612c741a7c2bad9ca7a4 (svn r7020) -Fix r6047: AI tries to delete stations that are 'in use' because FOR_ALL_STATIONS skips invalid stations diff -r 7ff1e87d59b9 -r 2d11c27a8492 ai/default/default.c --- a/ai/default/default.c Tue Oct 31 14:23:53 2006 +0000 +++ b/ai/default/default.c Tue Oct 31 17:13:12 2006 +0000 @@ -3555,7 +3555,6 @@ { // 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 @@ } // 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 @@ (tile = st->airport_tile) != 0)) { DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR); } - used++; } free(in_use);