summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 28d026feb..857c4df8a 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -530,7 +530,7 @@ void Vehicle::PreDestructor()
Station *st = GetTargetAirportIfValid(a);
if (st != NULL) {
const AirportFTA *layout = st->Airport()->layout;
- CLRBITS(st->airport_flags, layout[this->u.air.previous_pos].block | layout[this->u.air.pos].block);
+ CLRBITS(st->airport_flags, layout[a->previous_pos].block | layout[a->pos].block);
}
}
@@ -1571,10 +1571,13 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
/* If there is no depot in front, reverse automatically (trains only) */
if (this->type == VEH_TRAIN && reverse) DoCommand(this->tile, this->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
- if (this->type == VEH_AIRCRAFT && this->u.air.state == FLYING && this->u.air.targetairport != destination) {
- /* The aircraft is now heading for a different hangar than the next in the orders */
- extern void AircraftNextAirportPos_and_Order(Aircraft *a);
- AircraftNextAirportPos_and_Order((Aircraft *)this);
+ if (this->type == VEH_AIRCRAFT) {
+ Aircraft *a = (Aircraft *)this;
+ if (a->state == FLYING && a->targetairport != destination) {
+ /* The aircraft is now heading for a different hangar than the next in the orders */
+ extern void AircraftNextAirportPos_and_Order(Aircraft *a);
+ AircraftNextAirportPos_and_Order(a);
+ }
}
}