diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 97f6be00e5f9b..f36bfca4febea 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -146,7 +146,7 @@ static StationID FindNearestHangar(const Aircraft *v) const Station *last_dest = GetTargetAirportIfValid(v); const Station *next_dest; if (v->current_order.IsType(OT_GOTO_STATION) || - v->current_order.IsType(OT_GOTO_DEPOT) && v->current_order.GetDepotActionType() != ODATFB_NEAREST_DEPOT) { + (v->current_order.IsType(OT_GOTO_DEPOT) && v->current_order.GetDepotActionType() != ODATFB_NEAREST_DEPOT)) { next_dest = Station::GetIfValid(v->current_order.GetDestination()); if (next_dest == last_dest) last_dest = Station::GetIfValid(v->last_station_visited); } else { @@ -445,7 +445,7 @@ static void CheckIfAircraftNeedsService(Aircraft *v) } } - if (!hangar_in_o || !CanVehicleUseStation(v, st) && v->state >= TAKEOFF && v->state <= FLYING) { + if (!hangar_in_o || (!CanVehicleUseStation(v, st) && v->state >= TAKEOFF && v->state <= FLYING)) { /* there's no airport with a hangar in the orders, or the aircraft * can't use the airport, so look for a nearby hangar */ const StationID nearest_hangar = FindNearestHangar(v); @@ -453,9 +453,9 @@ static void CheckIfAircraftNeedsService(Aircraft *v) /* v->tile can't be used here, when aircraft is flying v->tile is set to 0 */ TileIndex vtile = TileVirtXY(v->x_pos, v->y_pos); - if (nearest_hangar != INVALID_STATION && (!CanVehicleUseStation(v, st) && v->state >= TAKEOFF && v->state <= FLYING || !st->airport.HasHangar() && + if (nearest_hangar != INVALID_STATION && ((!CanVehicleUseStation(v, st) && v->state >= TAKEOFF && v->state <= FLYING) || (!st->airport.HasHangar() && /* is nearest hangar closer than destination? */ - DistanceSquare(vtile, Station::Get(nearest_hangar)->airport.tile) <= DistanceSquare(vtile, st->airport.tile))) { + DistanceSquare(vtile, Station::Get(nearest_hangar)->airport.tile) <= DistanceSquare(vtile, st->airport.tile)))) { /* defer destination, service aircraft at that hangar now */ v->current_order.MakeGoToDepot(nearest_hangar, ODTFB_SERVICE); v->dest_tile = v->GetOrderStationLocation(nearest_hangar); @@ -1561,8 +1561,8 @@ static void AircraftEventHandler_AtTerminal(Aircraft *v, const AirportFTAClass * * ---> start moving */ if (Station::Get(v->targetairport)->airport.HasHangar()) { - if (v->NeedsAutomaticServicing() || v->subtype == AIR_HELICOPTER && v->HasPendingReplace() && _settings_game.order.serviceathelipad && - (!v->HasDepotOrder() || !(v->current_order.IsType(OT_GOTO_DEPOT) && v->current_order.GetDepotOrderType() != ODTFB_SERVICE))) { + if (v->NeedsAutomaticServicing() || (v->subtype == AIR_HELICOPTER && v->HasPendingReplace() && _settings_game.order.serviceathelipad && + (!v->HasDepotOrder() || !(v->current_order.IsType(OT_GOTO_DEPOT) && v->current_order.GetDepotOrderType() != ODTFB_SERVICE)))) { v->current_order.MakeGoToDepot(v->targetairport, ODTFB_SERVICE); SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP); } diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 13e3fbf3b3585..30225a2ef28f8 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -238,7 +238,6 @@ bool Vehicle::NeedsServicing() const if (this->vehstatus & (VS_STOPPED | VS_CRASHED)) return false; /* Are we ready for the next service cycle? */ - const Company *c = Company::Get(this->owner); if (this->ServiceIntervalIsPercent() ? (this->reliability >= this->GetEngine()->reliability * (100 - this->GetServiceInterval()) / 100) : (this->date_of_last_service + this->GetServiceInterval() >= _date)) {