mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-08 23:34:15 +00:00
parent
729caa135b
commit
6929429f0f
@ -129,8 +129,8 @@ static StationID FindNearestHangar(const Aircraft *v)
|
||||
uint max_range = v->acache.cached_max_range_sqr;
|
||||
|
||||
/* Determine destinations where it's coming from and where it's heading to */
|
||||
const Station *last_dest;
|
||||
const Station *next_dest;
|
||||
const Station *last_dest = nullptr;
|
||||
const Station *next_dest = nullptr;
|
||||
if (max_range != 0) {
|
||||
if (v->current_order.IsType(OT_GOTO_STATION) ||
|
||||
(v->current_order.IsType(OT_GOTO_DEPOT) && v->current_order.GetDepotActionType() != ODATFB_NEAREST_DEPOT)) {
|
||||
@ -155,8 +155,8 @@ static StationID FindNearestHangar(const Aircraft *v)
|
||||
|
||||
/* Check if our last and next destinations can be reached from the depot airport. */
|
||||
if (max_range != 0) {
|
||||
uint last_dist = last_dest != nullptr && last_dest->airport.tile != INVALID_TILE ? DistanceSquare(st->airport.tile, last_dest->airport.tile) : 0;
|
||||
uint next_dist = next_dest != nullptr && next_dest->airport.tile != INVALID_TILE ? DistanceSquare(st->airport.tile, next_dest->airport.tile) : 0;
|
||||
uint last_dist = (last_dest != nullptr && last_dest->airport.tile != INVALID_TILE) ? DistanceSquare(st->airport.tile, last_dest->airport.tile) : 0;
|
||||
uint next_dist = (next_dest != nullptr && next_dest->airport.tile != INVALID_TILE) ? DistanceSquare(st->airport.tile, next_dest->airport.tile) : 0;
|
||||
if (last_dist > max_range || next_dist > max_range) continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user