Skip to content

Commit

Permalink
Fix: Compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuXarick committed Oct 3, 2018
1 parent 786a435 commit c7741c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/aircraft_cmd.cpp
Expand Up @@ -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 {
Expand Down Expand Up @@ -445,17 +445,17 @@ 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);

/* 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);
Expand Down Expand Up @@ -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);
}
Expand Down
1 change: 0 additions & 1 deletion src/vehicle.cpp
Expand Up @@ -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)) {
Expand Down

0 comments on commit c7741c6

Please sign in to comment.