mirror of https://github.com/OpenTTD/OpenTTD
(svn r21273) -Codechange: Return values should start at the same line.
parent
38dc34828e
commit
ab50f74d7f
|
@ -45,13 +45,8 @@ static inline bool IsBridgeTile(TileIndex t)
|
||||||
*/
|
*/
|
||||||
static inline bool MayHaveBridgeAbove(TileIndex t)
|
static inline bool MayHaveBridgeAbove(TileIndex t)
|
||||||
{
|
{
|
||||||
return
|
return IsTileType(t, MP_CLEAR) || IsTileType(t, MP_RAILWAY) || IsTileType(t, MP_ROAD) ||
|
||||||
IsTileType(t, MP_CLEAR) ||
|
IsTileType(t, MP_WATER) || IsTileType(t, MP_TUNNELBRIDGE) || IsTileType(t, MP_OBJECT);
|
||||||
IsTileType(t, MP_RAILWAY) ||
|
|
||||||
IsTileType(t, MP_ROAD) ||
|
|
||||||
IsTileType(t, MP_WATER) ||
|
|
||||||
IsTileType(t, MP_TUNNELBRIDGE) ||
|
|
||||||
IsTileType(t, MP_OBJECT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -318,9 +318,7 @@ bool IsValidCommand(uint32 cmd)
|
||||||
{
|
{
|
||||||
cmd &= CMD_ID_MASK;
|
cmd &= CMD_ID_MASK;
|
||||||
|
|
||||||
return
|
return cmd < lengthof(_command_proc_table) && _command_proc_table[cmd].proc != NULL;
|
||||||
cmd < lengthof(_command_proc_table) &&
|
|
||||||
_command_proc_table[cmd].proc != NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -48,9 +48,7 @@ ObjectSpec _object_specs[NUM_OBJECTS];
|
||||||
|
|
||||||
bool ObjectSpec::IsAvailable() const
|
bool ObjectSpec::IsAvailable() const
|
||||||
{
|
{
|
||||||
return
|
return this->enabled && _date > this->introduction_date &&
|
||||||
this->enabled &&
|
|
||||||
_date > this->introduction_date &&
|
|
||||||
(_date < this->end_of_life_date || this->end_of_life_date < this->introduction_date + 365) &&
|
(_date < this->end_of_life_date || this->end_of_life_date < this->introduction_date + 365) &&
|
||||||
HasBit(this->climate, _settings_game.game_creation.landscape) &&
|
HasBit(this->climate, _settings_game.game_creation.landscape) &&
|
||||||
(flags & (_game_mode != GM_EDITOR ? OBJECT_FLAG_ONLY_IN_SCENEDIT : OBJECT_FLAG_ONLY_IN_GAME)) == 0;
|
(flags & (_game_mode != GM_EDITOR ? OBJECT_FLAG_ONLY_IN_SCENEDIT : OBJECT_FLAG_ONLY_IN_GAME)) == 0;
|
||||||
|
|
|
@ -817,10 +817,9 @@ bool IsStationTileElectrifiable(TileIndex tile)
|
||||||
{
|
{
|
||||||
const StationSpec *statspec = GetStationSpec(tile);
|
const StationSpec *statspec = GetStationSpec(tile);
|
||||||
|
|
||||||
return
|
return statspec == NULL ||
|
||||||
statspec == NULL ||
|
HasBit(statspec->pylons, GetStationGfx(tile)) ||
|
||||||
HasBit(statspec->pylons, GetStationGfx(tile)) ||
|
!HasBit(statspec->wires, GetStationGfx(tile));
|
||||||
!HasBit(statspec->wires, GetStationGfx(tile));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Helper class for animation control. */
|
/** Helper class for animation control. */
|
||||||
|
|
|
@ -115,15 +115,11 @@ bool Order::Equals(const Order &other) const
|
||||||
if ((this->IsType(OT_GOTO_DEPOT) && this->type == other.type) &&
|
if ((this->IsType(OT_GOTO_DEPOT) && this->type == other.type) &&
|
||||||
((this->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0 ||
|
((this->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0 ||
|
||||||
(other.GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0)) {
|
(other.GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0)) {
|
||||||
return
|
return this->GetDepotOrderType() == other.GetDepotOrderType() &&
|
||||||
this->GetDepotOrderType() == other.GetDepotOrderType() &&
|
(this->GetDepotActionType() & ~ODATFB_NEAREST_DEPOT) == (other.GetDepotActionType() & ~ODATFB_NEAREST_DEPOT);
|
||||||
(this->GetDepotActionType() & ~ODATFB_NEAREST_DEPOT) == (other.GetDepotActionType() & ~ODATFB_NEAREST_DEPOT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return this->type == other.type && this->flags == other.flags && this->dest == other.dest;
|
||||||
this->type == other.type &&
|
|
||||||
this->flags == other.flags &&
|
|
||||||
this->dest == other.dest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Order::Pack() const
|
uint32 Order::Pack() const
|
||||||
|
@ -1752,8 +1748,8 @@ bool ProcessOrders(Vehicle *v)
|
||||||
bool Order::ShouldStopAtStation(const Vehicle *v, StationID station) const
|
bool Order::ShouldStopAtStation(const Vehicle *v, StationID station) const
|
||||||
{
|
{
|
||||||
bool is_dest_station = this->IsType(OT_GOTO_STATION) && this->dest == station;
|
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
|
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. */
|
/* 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));
|
!(this->GetNonStopType() & (is_dest_station ? ONSF_NO_STOP_AT_DESTINATION_STATION : ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS));
|
||||||
|
|
|
@ -541,10 +541,9 @@ static int32 NPFFindSafeTile(AyStar *as, OpenListNode *current)
|
||||||
{
|
{
|
||||||
const Train *v = Train::From(((NPFFindStationOrTileData *)as->user_target)->v);
|
const Train *v = Train::From(((NPFFindStationOrTileData *)as->user_target)->v);
|
||||||
|
|
||||||
return
|
return (IsSafeWaitingPosition(v, current->path.node.tile, current->path.node.direction, true, _settings_game.pf.forbid_90_deg) &&
|
||||||
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)) ?
|
||||||
IsWaitingPositionFree(v, current->path.node.tile, current->path.node.direction, _settings_game.pf.forbid_90_deg) ?
|
AYSTAR_FOUND_END_NODE : AYSTAR_DONE;
|
||||||
AYSTAR_FOUND_END_NODE : AYSTAR_DONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Will find a station identified using the NPFFindStationOrTileData */
|
/* Will find a station identified using the NPFFindStationOrTileData */
|
||||||
|
|
|
@ -99,9 +99,8 @@ public:
|
||||||
/** Called by YAPF to detect if node ends in the desired destination */
|
/** Called by YAPF to detect if node ends in the desired destination */
|
||||||
FORCEINLINE bool PfDetectDestination(TileIndex tile, Trackdir td)
|
FORCEINLINE bool PfDetectDestination(TileIndex tile, Trackdir td)
|
||||||
{
|
{
|
||||||
return
|
return IsSafeWaitingPosition(Yapf().GetVehicle(), tile, td, true, !TrackFollower::Allow90degTurns()) &&
|
||||||
IsSafeWaitingPosition(Yapf().GetVehicle(), tile, td, true, !TrackFollower::Allow90degTurns()) &&
|
IsWaitingPositionFree(Yapf().GetVehicle(), tile, td, !TrackFollower::Allow90degTurns());
|
||||||
IsWaitingPositionFree(Yapf().GetVehicle(), tile, td, !TrackFollower::Allow90degTurns());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -424,9 +424,7 @@ static inline bool IsSignalPresent(TileIndex t, byte signalbit)
|
||||||
static inline bool HasSignalOnTrack(TileIndex tile, Track track)
|
static inline bool HasSignalOnTrack(TileIndex tile, Track track)
|
||||||
{
|
{
|
||||||
assert(IsValidTrack(track));
|
assert(IsValidTrack(track));
|
||||||
return
|
return GetRailTileType(tile) == RAIL_TILE_SIGNALS && (GetPresentSignals(tile) & SignalOnTrack(track)) != 0;
|
||||||
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)
|
static inline bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir)
|
||||||
{
|
{
|
||||||
assert (IsValidTrackdir(trackdir));
|
assert (IsValidTrackdir(trackdir));
|
||||||
return
|
return GetRailTileType(tile) == RAIL_TILE_SIGNALS && GetPresentSignals(tile) & SignalAlongTrackdir(trackdir);
|
||||||
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)
|
static inline bool HasPbsSignalOnTrackdir(TileIndex tile, Trackdir td)
|
||||||
{
|
{
|
||||||
return
|
return IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, td) &&
|
||||||
IsTileType(tile, MP_RAILWAY) &&
|
IsPbsSignal(GetSignalType(tile, TrackdirToTrack(td)));
|
||||||
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)
|
static inline bool HasOnewaySignalBlockingTrackdir(TileIndex tile, Trackdir td)
|
||||||
{
|
{
|
||||||
return
|
return IsTileType(tile, MP_RAILWAY) && HasSignalOnTrackdir(tile, ReverseTrackdir(td)) &&
|
||||||
IsTileType(tile, MP_RAILWAY) &&
|
!HasSignalOnTrackdir(tile, td) && IsOnewaySignal(tile, TrackdirToTrack(td));
|
||||||
HasSignalOnTrackdir(tile, ReverseTrackdir(td)) &&
|
|
||||||
!HasSignalOnTrackdir(tile, td) &&
|
|
||||||
IsOnewaySignal(tile, TrackdirToTrack(td));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -452,12 +452,10 @@ static Vehicle *EnumCheckRoadVehCrashTrain(Vehicle *v, void *data)
|
||||||
{
|
{
|
||||||
const Vehicle *u = (Vehicle*)data;
|
const Vehicle *u = (Vehicle*)data;
|
||||||
|
|
||||||
return
|
return (v->type == VEH_TRAIN &&
|
||||||
v->type == VEH_TRAIN &&
|
abs(v->z_pos - u->z_pos) <= 6 &&
|
||||||
abs(v->z_pos - u->z_pos) <= 6 &&
|
abs(v->x_pos - u->x_pos) <= 4 &&
|
||||||
abs(v->x_pos - u->x_pos) <= 4 &&
|
abs(v->y_pos - u->y_pos) <= 4) ? v : NULL;
|
||||||
abs(v->y_pos - u->y_pos) <= 4 ?
|
|
||||||
v : NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint RoadVehicle::Crash(bool flooded)
|
uint RoadVehicle::Crash(bool flooded)
|
||||||
|
@ -727,9 +725,7 @@ static Vehicle *EnumFindVehBlockingOvertake(Vehicle *v, void *data)
|
||||||
{
|
{
|
||||||
const OvertakeData *od = (OvertakeData*)data;
|
const OvertakeData *od = (OvertakeData*)data;
|
||||||
|
|
||||||
return
|
return (v->type == VEH_ROAD && v->First() == v && v != od->u && v != od->v) ? v : NULL;
|
||||||
v->type == VEH_ROAD && v->First() == v && v != od->u && v != od->v ?
|
|
||||||
v : NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -363,11 +363,8 @@ void StationRect::MakeEmpty()
|
||||||
*/
|
*/
|
||||||
bool StationRect::PtInExtendedRect(int x, int y, int distance) const
|
bool StationRect::PtInExtendedRect(int x, int y, int distance) const
|
||||||
{
|
{
|
||||||
return
|
return this->left - distance <= x && x <= this->right + distance &&
|
||||||
this->left - distance <= x &&
|
this->top - distance <= y && y <= this->bottom + distance;
|
||||||
x <= this->right + distance &&
|
|
||||||
this->top - distance <= y &&
|
|
||||||
y <= this->bottom + distance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StationRect::IsEmpty() const
|
bool StationRect::IsEmpty() const
|
||||||
|
|
|
@ -379,12 +379,10 @@ static inline TrackBits GetRailStationTrackBits(TileIndex t)
|
||||||
static inline bool IsCompatibleTrainStationTile(TileIndex t1, TileIndex t2)
|
static inline bool IsCompatibleTrainStationTile(TileIndex t1, TileIndex t2)
|
||||||
{
|
{
|
||||||
assert(IsRailStationTile(t2));
|
assert(IsRailStationTile(t2));
|
||||||
return
|
return IsRailStationTile(t1) && IsCompatibleRail(GetRailType(t1), GetRailType(t2)) &&
|
||||||
IsRailStationTile(t1) &&
|
GetRailStationAxis(t1) == GetRailStationAxis(t2) &&
|
||||||
IsCompatibleRail(GetRailType(t1), GetRailType(t2)) &&
|
GetStationIndex(t1) == GetStationIndex(t2) &&
|
||||||
GetRailStationAxis(t1) == GetRailStationAxis(t2) &&
|
!IsStationTileBlocked(t1);
|
||||||
GetStationIndex(t1) == GetStationIndex(t2) &&
|
|
||||||
!IsStationTileBlocked(t1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -273,10 +273,7 @@ static inline bool IsPrintable(WChar c)
|
||||||
*/
|
*/
|
||||||
static inline bool IsWhitespace(WChar c)
|
static inline bool IsWhitespace(WChar c)
|
||||||
{
|
{
|
||||||
return
|
return c == 0x0020 /* SPACE */ || c == 0x3000; /* IDEOGRAPHIC SPACE */
|
||||||
c == 0x0020 /* SPACE */ ||
|
|
||||||
c == 0x3000 /* IDEOGRAPHIC SPACE */
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Needed for NetBSD version (so feature) testing */
|
/* Needed for NetBSD version (so feature) testing */
|
||||||
|
|
|
@ -1308,20 +1308,19 @@ static inline void SortNetworkLanguages() {}
|
||||||
|
|
||||||
bool LanguagePackHeader::IsValid() const
|
bool LanguagePackHeader::IsValid() const
|
||||||
{
|
{
|
||||||
return
|
return this->ident == TO_LE32(LanguagePackHeader::IDENT) &&
|
||||||
this->ident == TO_LE32(LanguagePackHeader::IDENT) &&
|
this->version == TO_LE32(LANGUAGE_PACK_VERSION) &&
|
||||||
this->version == TO_LE32(LANGUAGE_PACK_VERSION) &&
|
this->plural_form < LANGUAGE_MAX_PLURAL &&
|
||||||
this->plural_form < LANGUAGE_MAX_PLURAL &&
|
this->text_dir <= 1 &&
|
||||||
this->text_dir <= 1 &&
|
this->newgrflangid < MAX_LANG &&
|
||||||
this->newgrflangid < MAX_LANG &&
|
this->num_genders < MAX_NUM_GENDERS &&
|
||||||
this->num_genders < MAX_NUM_GENDERS &&
|
this->num_cases < MAX_NUM_CASES &&
|
||||||
this->num_cases < MAX_NUM_CASES &&
|
StrValid(this->name, lastof(this->name)) &&
|
||||||
StrValid(this->name, lastof(this->name)) &&
|
StrValid(this->own_name, lastof(this->own_name)) &&
|
||||||
StrValid(this->own_name, lastof(this->own_name)) &&
|
StrValid(this->isocode, lastof(this->isocode)) &&
|
||||||
StrValid(this->isocode, lastof(this->isocode)) &&
|
StrValid(this->digit_group_separator, lastof(this->digit_group_separator)) &&
|
||||||
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_group_separator_currency, lastof(this->digit_group_separator_currency)) &&
|
StrValid(this->digit_decimal_separator, lastof(this->digit_decimal_separator));
|
||||||
StrValid(this->digit_decimal_separator, lastof(this->digit_decimal_separator));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReadLanguagePack(const LanguageMetadata *lang)
|
bool ReadLanguagePack(const LanguageMetadata *lang)
|
||||||
|
|
|
@ -2703,11 +2703,8 @@ static void TrainEnterStation(Train *v, StationID station)
|
||||||
/* Check if the vehicle is compatible with the specified tile */
|
/* Check if the vehicle is compatible with the specified tile */
|
||||||
static inline bool CheckCompatibleRail(const Train *v, TileIndex tile)
|
static inline bool CheckCompatibleRail(const Train *v, TileIndex tile)
|
||||||
{
|
{
|
||||||
return
|
return IsTileOwner(tile, v->owner) &&
|
||||||
IsTileOwner(tile, v->owner) && (
|
(!v->IsFrontEngine() || HasBit(v->compatible_railtypes, GetRailType(tile)));
|
||||||
!v->IsFrontEngine() ||
|
|
||||||
HasBit(v->compatible_railtypes, GetRailType(tile))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct RailtypeSlowdownParams {
|
struct RailtypeSlowdownParams {
|
||||||
|
|
|
@ -56,10 +56,7 @@ bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir)
|
||||||
height = GetTileZ(tile);
|
height = GetTileZ(tile);
|
||||||
} while (z < height);
|
} while (z < height);
|
||||||
|
|
||||||
return
|
return z == height && IsTunnelTile(tile) && GetTunnelBridgeDirection(tile) == dir;
|
||||||
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)
|
bool IsTunnelInWay(TileIndex tile, uint z)
|
||||||
{
|
{
|
||||||
return
|
return IsTunnelInWayDir(tile, z, (TileX(tile) > (MapMaxX() / 2)) ? DIAGDIR_NE : DIAGDIR_SW) ||
|
||||||
IsTunnelInWayDir(tile, z, (TileX(tile) > (MapMaxX() / 2)) ? DIAGDIR_NE : DIAGDIR_SW) ||
|
IsTunnelInWayDir(tile, z, (TileY(tile) > (MapMaxY() / 2)) ? DIAGDIR_NW : DIAGDIR_SE);
|
||||||
IsTunnelInWayDir(tile, z, (TileY(tile) > (MapMaxY() / 2)) ? DIAGDIR_NW : DIAGDIR_SE);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
x = ScaleByZoom(x - vp->left, vp->zoom) + vp->virtual_left;
|
||||||
y = ScaleByZoom(y - vp->top, vp->zoom) + vp->virtual_top;
|
y = ScaleByZoom(y - vp->top, vp->zoom) + vp->virtual_top;
|
||||||
|
|
||||||
return
|
return y >= sign->top && y < sign->top + sign_height &&
|
||||||
y >= sign->top &&
|
x >= sign->center - sign_half_width && x < sign->center + sign_half_width;
|
||||||
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)
|
static bool CheckClickOnTown(const ViewPort *vp, int x, int y)
|
||||||
|
|
Loading…
Reference in New Issue