diff --git a/src/bridge_map.h b/src/bridge_map.h index 8c364cb679..796bae28ac 100644 --- a/src/bridge_map.h +++ b/src/bridge_map.h @@ -45,13 +45,8 @@ static inline bool IsBridgeTile(TileIndex t) */ static inline bool MayHaveBridgeAbove(TileIndex t) { - return - IsTileType(t, MP_CLEAR) || - IsTileType(t, MP_RAILWAY) || - IsTileType(t, MP_ROAD) || - IsTileType(t, MP_WATER) || - IsTileType(t, MP_TUNNELBRIDGE) || - IsTileType(t, MP_OBJECT); + return IsTileType(t, MP_CLEAR) || IsTileType(t, MP_RAILWAY) || IsTileType(t, MP_ROAD) || + IsTileType(t, MP_WATER) || IsTileType(t, MP_TUNNELBRIDGE) || IsTileType(t, MP_OBJECT); } /** diff --git a/src/command.cpp b/src/command.cpp index 8078e9a9ed..1894244fc2 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -318,9 +318,7 @@ bool IsValidCommand(uint32 cmd) { cmd &= CMD_ID_MASK; - return - cmd < lengthof(_command_proc_table) && - _command_proc_table[cmd].proc != NULL; + return cmd < lengthof(_command_proc_table) && _command_proc_table[cmd].proc != NULL; } /*! diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp index 3215d1888e..b27f4c5648 100644 --- a/src/newgrf_object.cpp +++ b/src/newgrf_object.cpp @@ -48,9 +48,7 @@ ObjectSpec _object_specs[NUM_OBJECTS]; bool ObjectSpec::IsAvailable() const { - return - this->enabled && - _date > this->introduction_date && + return this->enabled && _date > this->introduction_date && (_date < this->end_of_life_date || this->end_of_life_date < this->introduction_date + 365) && HasBit(this->climate, _settings_game.game_creation.landscape) && (flags & (_game_mode != GM_EDITOR ? OBJECT_FLAG_ONLY_IN_SCENEDIT : OBJECT_FLAG_ONLY_IN_GAME)) == 0; diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 749ab0ea8b..b27a09fe3e 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -817,10 +817,9 @@ bool IsStationTileElectrifiable(TileIndex tile) { const StationSpec *statspec = GetStationSpec(tile); - return - statspec == NULL || - HasBit(statspec->pylons, GetStationGfx(tile)) || - !HasBit(statspec->wires, GetStationGfx(tile)); + return statspec == NULL || + HasBit(statspec->pylons, GetStationGfx(tile)) || + !HasBit(statspec->wires, GetStationGfx(tile)); } /** Helper class for animation control. */ diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index b792c9beb1..d02522cc6e 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -115,15 +115,11 @@ bool Order::Equals(const Order &other) const if ((this->IsType(OT_GOTO_DEPOT) && this->type == other.type) && ((this->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0 || (other.GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0)) { - return - this->GetDepotOrderType() == other.GetDepotOrderType() && - (this->GetDepotActionType() & ~ODATFB_NEAREST_DEPOT) == (other.GetDepotActionType() & ~ODATFB_NEAREST_DEPOT); + return this->GetDepotOrderType() == other.GetDepotOrderType() && + (this->GetDepotActionType() & ~ODATFB_NEAREST_DEPOT) == (other.GetDepotActionType() & ~ODATFB_NEAREST_DEPOT); } - return - this->type == other.type && - this->flags == other.flags && - this->dest == other.dest; + return this->type == other.type && this->flags == other.flags && this->dest == other.dest; } uint32 Order::Pack() const @@ -1752,8 +1748,8 @@ bool ProcessOrders(Vehicle *v) bool Order::ShouldStopAtStation(const Vehicle *v, StationID station) const { bool is_dest_station = this->IsType(OT_GOTO_STATION) && this->dest == station; - return - (!this->IsType(OT_GOTO_DEPOT) || (this->GetDepotOrderType() & ODTFB_PART_OF_ORDERS) != 0) && + + return (!this->IsType(OT_GOTO_DEPOT) || (this->GetDepotOrderType() & ODTFB_PART_OF_ORDERS) != 0) && v->last_station_visited != station && // Do stop only when we've not just been there /* Finally do stop when there is no non-stop flag set for this type of station. */ !(this->GetNonStopType() & (is_dest_station ? ONSF_NO_STOP_AT_DESTINATION_STATION : ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS)); diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index 04213b4052..d6ad43e4dc 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -541,10 +541,9 @@ static int32 NPFFindSafeTile(AyStar *as, OpenListNode *current) { const Train *v = Train::From(((NPFFindStationOrTileData *)as->user_target)->v); - return - IsSafeWaitingPosition(v, current->path.node.tile, current->path.node.direction, true, _settings_game.pf.forbid_90_deg) && - IsWaitingPositionFree(v, current->path.node.tile, current->path.node.direction, _settings_game.pf.forbid_90_deg) ? - AYSTAR_FOUND_END_NODE : AYSTAR_DONE; + return (IsSafeWaitingPosition(v, current->path.node.tile, current->path.node.direction, true, _settings_game.pf.forbid_90_deg) && + IsWaitingPositionFree(v, current->path.node.tile, current->path.node.direction, _settings_game.pf.forbid_90_deg)) ? + AYSTAR_FOUND_END_NODE : AYSTAR_DONE; } /* Will find a station identified using the NPFFindStationOrTileData */ diff --git a/src/pathfinder/yapf/yapf_destrail.hpp b/src/pathfinder/yapf/yapf_destrail.hpp index fa6ddfba30..605ee7a50e 100644 --- a/src/pathfinder/yapf/yapf_destrail.hpp +++ b/src/pathfinder/yapf/yapf_destrail.hpp @@ -99,9 +99,8 @@ public: /** Called by YAPF to detect if node ends in the desired destination */ FORCEINLINE bool PfDetectDestination(TileIndex tile, Trackdir td) { - return - IsSafeWaitingPosition(Yapf().GetVehicle(), tile, td, true, !TrackFollower::Allow90degTurns()) && - IsWaitingPositionFree(Yapf().GetVehicle(), tile, td, !TrackFollower::Allow90degTurns()); + return IsSafeWaitingPosition(Yapf().GetVehicle(), tile, td, true, !TrackFollower::Allow90degTurns()) && + IsWaitingPositionFree(Yapf().GetVehicle(), tile, td, !TrackFollower::Allow90degTurns()); } /** diff --git a/src/rail_map.h b/src/rail_map.h index d05f541466..59a1feeda5 100644 --- a/src/rail_map.h +++ b/src/rail_map.h @@ -424,9 +424,7 @@ static inline bool IsSignalPresent(TileIndex t, byte signalbit) static inline bool HasSignalOnTrack(TileIndex tile, Track track) { assert(IsValidTrack(track)); - return - GetRailTileType(tile) == RAIL_TILE_SIGNALS && - (GetPresentSignals(tile) & SignalOnTrack(track)) != 0; + return GetRailTileType(tile) == RAIL_TILE_SIGNALS && (GetPresentSignals(tile) & SignalOnTrack(track)) != 0; } /** @@ -439,9 +437,7 @@ static inline bool HasSignalOnTrack(TileIndex tile, Track track) static inline bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir) { assert (IsValidTrackdir(trackdir)); - return - GetRailTileType(tile) == RAIL_TILE_SIGNALS && - GetPresentSignals(tile) & SignalAlongTrackdir(trackdir); + return GetRailTileType(tile) == RAIL_TILE_SIGNALS && GetPresentSignals(tile) & SignalAlongTrackdir(trackdir); } /** @@ -477,10 +473,8 @@ static inline void SetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir, S */ static inline bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td) { - return - IsTileType(tile, MP_RAILWAY) && - HasSignalOnTrackdir(tile, td) && - IsPbsSignal(GetSignalType(tile, TrackdirToTrack(td))); + return IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, td) && + IsPbsSignal(GetSignalType(tile, TrackdirToTrack(td))); } /** @@ -491,11 +485,8 @@ static inline bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td) */ static inline bool HasOnewaySignalBlockingTrackdir(TileIndex tile, Trackdir td) { - return - IsTileType(tile, MP_RAILWAY) && - HasSignalOnTrackdir(tile, ReverseTrackdir(td)) && - !HasSignalOnTrackdir(tile, td) && - IsOnewaySignal(tile, TrackdirToTrack(td)); + return IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, ReverseTrackdir(td)) && + !HasSignalOnTrackdir(tile, td) && IsOnewaySignal(tile, TrackdirToTrack(td)); } diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 3889e2fa98..364cb879e4 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -452,12 +452,10 @@ static Vehicle *EnumCheckRoadVehCrashTrain(Vehicle *v, void *data) { const Vehicle *u = (Vehicle*)data; - return - v->type == VEH_TRAIN && - abs(v->z_pos - u->z_pos) <= 6 && - abs(v->x_pos - u->x_pos) <= 4 && - abs(v->y_pos - u->y_pos) <= 4 ? - v : NULL; + return (v->type == VEH_TRAIN && + abs(v->z_pos - u->z_pos) <= 6 && + abs(v->x_pos - u->x_pos) <= 4 && + abs(v->y_pos - u->y_pos) <= 4) ? v : NULL; } uint RoadVehicle::Crash(bool flooded) @@ -727,9 +725,7 @@ static Vehicle *EnumFindVehBlockingOvertake(Vehicle *v, void *data) { const OvertakeData *od = (OvertakeData*)data; - return - v->type == VEH_ROAD && v->First() == v && v != od->u && v != od->v ? - v : NULL; + return (v->type == VEH_ROAD && v->First() == v && v != od->u && v != od->v) ? v : NULL; } /** diff --git a/src/station.cpp b/src/station.cpp index 956dde1ab2..6ad19475ff 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -363,11 +363,8 @@ void StationRect::MakeEmpty() */ bool StationRect::PtInExtendedRect(int x, int y, int distance) const { - return - this->left - distance <= x && - x <= this->right + distance && - this->top - distance <= y && - y <= this->bottom + distance; + return this->left - distance <= x && x <= this->right + distance && + this->top - distance <= y && y <= this->bottom + distance; } bool StationRect::IsEmpty() const diff --git a/src/station_map.h b/src/station_map.h index 8d3bcb54d9..661cc834c8 100644 --- a/src/station_map.h +++ b/src/station_map.h @@ -379,12 +379,10 @@ static inline TrackBits GetRailStationTrackBits(TileIndex t) static inline bool IsCompatibleTrainStationTile(TileIndex t1, TileIndex t2) { assert(IsRailStationTile(t2)); - return - IsRailStationTile(t1) && - IsCompatibleRail(GetRailType(t1), GetRailType(t2)) && - GetRailStationAxis(t1) == GetRailStationAxis(t2) && - GetStationIndex(t1) == GetStationIndex(t2) && - !IsStationTileBlocked(t1); + return IsRailStationTile(t1) && IsCompatibleRail(GetRailType(t1), GetRailType(t2)) && + GetRailStationAxis(t1) == GetRailStationAxis(t2) && + GetStationIndex(t1) == GetStationIndex(t2) && + !IsStationTileBlocked(t1); } /** diff --git a/src/string_func.h b/src/string_func.h index 802b62e500..163ca3aed6 100644 --- a/src/string_func.h +++ b/src/string_func.h @@ -273,10 +273,7 @@ static inline bool IsPrintable(WChar c) */ static inline bool IsWhitespace(WChar c) { - return - c == 0x0020 /* SPACE */ || - c == 0x3000 /* IDEOGRAPHIC SPACE */ - ; + return c == 0x0020 /* SPACE */ || c == 0x3000; /* IDEOGRAPHIC SPACE */ } /* Needed for NetBSD version (so feature) testing */ diff --git a/src/strings.cpp b/src/strings.cpp index d9535315a6..8b1fd6adef 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -1308,20 +1308,19 @@ static inline void SortNetworkLanguages() {} bool LanguagePackHeader::IsValid() const { - return - this->ident == TO_LE32(LanguagePackHeader::IDENT) && - this->version == TO_LE32(LANGUAGE_PACK_VERSION) && - this->plural_form < LANGUAGE_MAX_PLURAL && - this->text_dir <= 1 && - this->newgrflangid < MAX_LANG && - this->num_genders < MAX_NUM_GENDERS && - this->num_cases < MAX_NUM_CASES && - StrValid(this->name, lastof(this->name)) && - StrValid(this->own_name, lastof(this->own_name)) && - StrValid(this->isocode, lastof(this->isocode)) && - StrValid(this->digit_group_separator, lastof(this->digit_group_separator)) && - StrValid(this->digit_group_separator_currency, lastof(this->digit_group_separator_currency)) && - StrValid(this->digit_decimal_separator, lastof(this->digit_decimal_separator)); + return this->ident == TO_LE32(LanguagePackHeader::IDENT) && + this->version == TO_LE32(LANGUAGE_PACK_VERSION) && + this->plural_form < LANGUAGE_MAX_PLURAL && + this->text_dir <= 1 && + this->newgrflangid < MAX_LANG && + this->num_genders < MAX_NUM_GENDERS && + this->num_cases < MAX_NUM_CASES && + StrValid(this->name, lastof(this->name)) && + StrValid(this->own_name, lastof(this->own_name)) && + StrValid(this->isocode, lastof(this->isocode)) && + StrValid(this->digit_group_separator, lastof(this->digit_group_separator)) && + StrValid(this->digit_group_separator_currency, lastof(this->digit_group_separator_currency)) && + StrValid(this->digit_decimal_separator, lastof(this->digit_decimal_separator)); } bool ReadLanguagePack(const LanguageMetadata *lang) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 26b45b1f18..7fd8747325 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2703,11 +2703,8 @@ static void TrainEnterStation(Train *v, StationID station) /* Check if the vehicle is compatible with the specified tile */ static inline bool CheckCompatibleRail(const Train *v, TileIndex tile) { - return - IsTileOwner(tile, v->owner) && ( - !v->IsFrontEngine() || - HasBit(v->compatible_railtypes, GetRailType(tile)) - ); + return IsTileOwner(tile, v->owner) && + (!v->IsFrontEngine() || HasBit(v->compatible_railtypes, GetRailType(tile))); } struct RailtypeSlowdownParams { diff --git a/src/tunnel_map.cpp b/src/tunnel_map.cpp index 47b93adf2b..799b390007 100644 --- a/src/tunnel_map.cpp +++ b/src/tunnel_map.cpp @@ -56,10 +56,7 @@ bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir) height = GetTileZ(tile); } while (z < height); - return - z == height && - IsTunnelTile(tile) && - GetTunnelBridgeDirection(tile) == dir; + return z == height && IsTunnelTile(tile) && GetTunnelBridgeDirection(tile) == dir; } /** @@ -70,7 +67,6 @@ bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir) */ bool IsTunnelInWay(TileIndex tile, uint z) { - return - IsTunnelInWayDir(tile, z, (TileX(tile) > (MapMaxX() / 2)) ? DIAGDIR_NE : DIAGDIR_SW) || - IsTunnelInWayDir(tile, z, (TileY(tile) > (MapMaxY() / 2)) ? DIAGDIR_NW : DIAGDIR_SE); + return IsTunnelInWayDir(tile, z, (TileX(tile) > (MapMaxX() / 2)) ? DIAGDIR_NE : DIAGDIR_SW) || + IsTunnelInWayDir(tile, z, (TileY(tile) > (MapMaxY() / 2)) ? DIAGDIR_NW : DIAGDIR_SE); } diff --git a/src/viewport.cpp b/src/viewport.cpp index 3b25c9efea..01b98effa9 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1729,11 +1729,8 @@ static bool CheckClickOnViewportSign(const ViewPort *vp, int x, int y, const Vie x = ScaleByZoom(x - vp->left, vp->zoom) + vp->virtual_left; y = ScaleByZoom(y - vp->top, vp->zoom) + vp->virtual_top; - return - y >= sign->top && - y < sign->top + sign_height && - x >= sign->center - sign_half_width && - x < sign->center + sign_half_width; + return y >= sign->top && y < sign->top + sign_height && + x >= sign->center - sign_half_width && x < sign->center + sign_half_width; } static bool CheckClickOnTown(const ViewPort *vp, int x, int y)