Mercurial > hg > openttd
changeset 19921:eabd618abcc9 draft
(svn r24855) -Fix [FS#5405]: Don't send aircraft to depots that are out of range of the next destination.
author | michi_cc <michi_cc@openttd.org> |
---|---|
date | Wed, 26 Dec 2012 12:45:19 +0000 |
parents | 02bef4e7d565 |
children | 0dab37af8b7e |
files | src/aircraft_cmd.cpp |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -136,6 +136,11 @@ /* v->tile can't be used here, when aircraft is flying v->tile is set to 0 */ uint distance = DistanceSquare(vtile, st->airport.tile); + if (v->acache.cached_max_range_sqr != 0) { + /* Check if our current destination can be reached from the depot airport. */ + const Station *cur_dest = GetTargetAirportIfValid(v); + if (cur_dest != NULL && DistanceSquare(st->airport.tile, cur_dest->airport.tile) > v->acache.cached_max_range_sqr) continue; + } if (distance < best || index == INVALID_STATION) { best = distance; index = st->index;