(svn r21273) -Codechange: Return values should start at the same line.

This commit is contained in:
alberth 2010-11-20 15:44:24 +00:00
parent 38dc34828e
commit ab50f74d7f
16 changed files with 55 additions and 103 deletions

View File

@ -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);
}
/**

View File

@ -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;
}
/*!

View File

@ -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;

View File

@ -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. */

View File

@ -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));

View File

@ -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 */

View File

@ -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());
}
/**

View File

@ -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));
}

View File

@ -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;
}
/**

View File

@ -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

View File

@ -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);
}
/**

View File

@ -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 */

View File

@ -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)

View File

@ -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 {

View File

@ -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);
}

View File

@ -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)