diff options
author | rubidium <rubidium@openttd.org> | 2009-07-21 22:37:10 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-07-21 22:37:10 +0000 |
commit | 8405d7d7e762546e3e78d1e0c16bb226c36266fa (patch) | |
tree | 11d3829fce669b25be64f203da5d93319a0c3cdc | |
parent | 8083d67780d6a85c558080ec99dd2d24ae755d0f (diff) | |
download | openttd-8405d7d7e762546e3e78d1e0c16bb226c36266fa.tar.xz |
(svn r16907) -Codechange: make a more clear distinction between reservation functions that return a bool and that return TrackBits; GetRailStationReservation vs GetRailwayStationReservation, which one returns the bool and which one the TrackBits?
-rw-r--r-- | src/newgrf_station.cpp | 4 | ||||
-rw-r--r-- | src/pbs.cpp | 20 | ||||
-rw-r--r-- | src/rail_cmd.cpp | 12 | ||||
-rw-r--r-- | src/rail_map.h | 16 | ||||
-rw-r--r-- | src/road_cmd.cpp | 6 | ||||
-rw-r--r-- | src/road_map.h | 6 | ||||
-rw-r--r-- | src/station_cmd.cpp | 8 | ||||
-rw-r--r-- | src/station_map.h | 6 | ||||
-rw-r--r-- | src/train_cmd.cpp | 10 | ||||
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 8 | ||||
-rw-r--r-- | src/tunnelbridge_map.h | 6 | ||||
-rw-r--r-- | src/waypoint_cmd.cpp | 6 | ||||
-rw-r--r-- | src/yapf/follow_track.hpp | 2 | ||||
-rw-r--r-- | src/yapf/yapf_costrail.hpp | 2 | ||||
-rw-r--r-- | src/yapf/yapf_rail.cpp | 2 |
15 files changed, 57 insertions, 57 deletions
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 54c68d13d..3cd21e985 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -452,9 +452,9 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by case 0x43: return st->owner; // Station owner case 0x44: if (IsRailWaypointTile(tile)) { - return GetDepotWaypointReservation(tile) ? 7 : 4; + return HasDepotWaypointReservation(tile) ? 7 : 4; } else { - return GetRailwayStationReservation(tile) ? 7 : 4; // PBS status + return HasStationReservation(tile) ? 7 : 4; // PBS status } case 0x45: if (!HasBit(_svc.valid, 2)) { _svc.v45 = GetRailContinuationInfo(tile); SetBit(_svc.valid, 2); } diff --git a/src/pbs.cpp b/src/pbs.cpp index f4898e0e2..b74cfa419 100644 --- a/src/pbs.cpp +++ b/src/pbs.cpp @@ -17,20 +17,20 @@ TrackBits GetReservedTrackbits(TileIndex t) { switch (GetTileType(t)) { case MP_RAILWAY: - if (IsRailWaypoint(t) || IsRailDepot(t)) return GetRailWaypointReservation(t); - if (IsPlainRail(t)) return GetTrackReservation(t); + if (IsRailWaypoint(t) || IsRailDepot(t)) return GetWaypointReservationTrackBits(t); + if (IsPlainRail(t)) return GetRailReservationTrackBits(t); break; case MP_ROAD: - if (IsLevelCrossing(t)) return GetRailCrossingReservation(t); + if (IsLevelCrossing(t)) return GetCrossingReservationTrackBits(t); break; case MP_STATION: - if (IsRailwayStation(t)) return GetRailStationReservation(t); + if (IsRailwayStation(t)) return GetStationReservationTrackBits(t); break; case MP_TUNNELBRIDGE: - if (GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL) return GetRailTunnelBridgeReservation(t); + if (GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL) return GetTunnelBridgeReservationTrackBits(t); break; default: @@ -81,7 +81,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t) case MP_RAILWAY: if (IsPlainRail(tile)) return TryReserveTrack(tile, t); if (IsRailWaypoint(tile) || IsRailDepot(tile)) { - if (!GetDepotWaypointReservation(tile)) { + if (!HasDepotWaypointReservation(tile)) { SetDepotWaypointReservation(tile, true); MarkTileDirtyByTile(tile); // some GRFs change their appearance when tile is reserved return true; @@ -90,7 +90,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t) break; case MP_ROAD: - if (IsLevelCrossing(tile) && !GetCrossingReservation(tile)) { + if (IsLevelCrossing(tile) && !HasCrossingReservation(tile)) { SetCrossingReservation(tile, true); BarCrossing(tile); MarkTileDirtyByTile(tile); // crossing barred, make tile dirty @@ -99,7 +99,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t) break; case MP_STATION: - if (IsRailwayStation(tile) && !GetRailwayStationReservation(tile)) { + if (IsRailwayStation(tile) && !HasStationReservation(tile)) { SetRailwayStationReservation(tile, true); MarkTileDirtyByTile(tile); // some GRFs need redraw after reserving track return true; @@ -107,7 +107,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t) break; case MP_TUNNELBRIDGE: - if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL && !GetRailTunnelBridgeReservation(tile)) { + if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL && !GetTunnelBridgeReservationTrackBits(tile)) { SetTunnelBridgeReservation(tile, true); return true; } @@ -261,7 +261,7 @@ PBSTileInfo FollowTrainReservation(const Train *v, bool *train_on_res) TileIndex tile = v->tile; Trackdir trackdir = v->GetVehicleTrackdir(); - if (IsRailDepotTile(tile) && !GetRailDepotReservation(tile)) return PBSTileInfo(tile, trackdir, false); + if (IsRailDepotTile(tile) && !GetDepotReservationTrackBits(tile)) return PBSTileInfo(tile, trackdir, false); FindTrainOnTrackInfo ftoti; ftoti.res = FollowReservation(v->owner, GetRailTypeInfo(v->railtype)->compatible_railtypes, tile, trackdir); diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index fc79d413a..6a58f2827 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -514,7 +514,7 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, } } else { SetTrackBits(tile, present); - SetTrackReservation(tile, GetTrackReservation(tile) & present); + SetTrackReservation(tile, GetRailReservationTrackBits(tile) & present); } } break; @@ -949,7 +949,7 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, if (IsPbsSignal(sigtype)) { /* PBS signals should show red unless they are on a reservation. */ uint mask = GetPresentSignals(tile) & SignalOnTrack(track); - SetSignalStates(tile, (GetSignalStates(tile) & ~mask) | ((HasBit(GetTrackReservation(tile), track) ? UINT_MAX : 0) & mask)); + SetSignalStates(tile, (GetSignalStates(tile) & ~mask) | ((HasBit(GetRailReservationTrackBits(tile), track) ? UINT_MAX : 0) & mask)); } MarkTileDirtyByTile(tile); AddTrackToSignalBuffer(tile, track, _current_company); @@ -1376,7 +1376,7 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 if (flags & DC_EXEC) { Track track = DiagDirToDiagTrack(GetTunnelBridgeDirection(tile)); - if (GetTunnelBridgeReservation(tile)) { + if (HasTunnelBridgeReservation(tile)) { Train *v = GetTrainForReservation(tile, track); if (v != NULL && !HasPowerOnRail(v->railtype, totype)) { /* No power on new rail type, reroute. */ @@ -1439,7 +1439,7 @@ static CommandCost RemoveTrainDepot(TileIndex tile, DoCommandFlag flags) Owner owner = GetTileOwner(tile); Train *v = NULL; - if (GetDepotWaypointReservation(tile)) { + if (HasDepotWaypointReservation(tile)) { v = GetTrainForReservation(tile, DiagDirToDiagTrack(dir)); if (v != NULL) FreeTrainTrackReservation(v); } @@ -1797,7 +1797,7 @@ static void DrawTrackBits(TileInfo *ti, TrackBits track) /* PBS debugging, draw reserved tracks darker */ if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation) { /* Get reservation, but mask track on halftile slope */ - TrackBits pbs = GetTrackReservation(ti->tile) & track; + TrackBits pbs = GetRailReservationTrackBits(ti->tile) & track; if (pbs & TRACK_BIT_X) { if (ti->tileh == SLOPE_FLAT || ti->tileh == SLOPE_ELEVATED) { DrawGroundSprite(rti->base_sprites.single_y, PALETTE_CRASH); @@ -1983,7 +1983,7 @@ default_waypoint: DrawGroundSprite(image, GroundSpritePaletteTransform(image, pal, _drawtile_track_palette)); /* PBS debugging, draw reserved tracks darker */ - if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && GetDepotWaypointReservation(ti->tile) && + if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasDepotWaypointReservation(ti->tile) && (!IsRailDepot(ti->tile) || GetRailDepotDirection(ti->tile) == DIAGDIR_SW || GetRailDepotDirection(ti->tile) == DIAGDIR_SE)) { DrawGroundSprite(GetWaypointAxis(ti->tile) == AXIS_X ? rti->base_sprites.single_y : rti->base_sprites.single_x, PALETTE_CRASH); } diff --git a/src/rail_map.h b/src/rail_map.h index bfdc19f6d..8fe1bf2ba 100644 --- a/src/rail_map.h +++ b/src/rail_map.h @@ -253,7 +253,7 @@ static inline WaypointID GetWaypointIndex(TileIndex t) * @param t the tile to query * @return the track bits */ -static inline TrackBits GetTrackReservation(TileIndex t) +static inline TrackBits GetRailReservationTrackBits(TileIndex t) { assert(IsPlainRailTile(t)); byte track_b = GB(_m[t].m2, 8, 3); @@ -289,7 +289,7 @@ static inline bool TryReserveTrack(TileIndex tile, Track t) { assert(HasTrack(tile, t)); TrackBits bits = TrackToTrackBits(t); - TrackBits res = GetTrackReservation(tile); + TrackBits res = GetRailReservationTrackBits(tile); if ((res & bits) != TRACK_BIT_NONE) return false; // already reserved res |= bits; if (TracksOverlap(res)) return false; // crossing reservation present @@ -306,7 +306,7 @@ static inline bool TryReserveTrack(TileIndex tile, Track t) static inline void UnreserveTrack(TileIndex tile, Track t) { assert(HasTrack(tile, t)); - TrackBits res = GetTrackReservation(tile); + TrackBits res = GetRailReservationTrackBits(tile); res &= ~TrackToTrackBits(t); SetTrackReservation(tile, res); } @@ -318,7 +318,7 @@ static inline void UnreserveTrack(TileIndex tile, Track t) * @param t the waypoint/depot tile * @return reservation state */ -static inline bool GetDepotWaypointReservation(TileIndex t) +static inline bool HasDepotWaypointReservation(TileIndex t) { assert(IsRailWaypoint(t) || IsRailDepot(t)); return HasBit(_m[t].m5, 4); @@ -343,9 +343,9 @@ static inline void SetDepotWaypointReservation(TileIndex t, bool b) * @param t the tile * @return reserved track bits */ -static inline TrackBits GetRailWaypointReservation(TileIndex t) +static inline TrackBits GetWaypointReservationTrackBits(TileIndex t) { - return GetDepotWaypointReservation(t) ? GetRailWaypointBits(t) : TRACK_BIT_NONE; + return HasDepotWaypointReservation(t) ? GetRailWaypointBits(t) : TRACK_BIT_NONE; } /** @@ -354,9 +354,9 @@ static inline TrackBits GetRailWaypointReservation(TileIndex t) * @param t the tile * @return reserved track bits */ -static inline TrackBits GetRailDepotReservation(TileIndex t) +static inline TrackBits GetDepotReservationTrackBits(TileIndex t) { - return GetDepotWaypointReservation(t) ? TrackToTrackBits(GetRailDepotTrack(t)) : TRACK_BIT_NONE; + return HasDepotWaypointReservation(t) ? TrackToTrackBits(GetRailDepotTrack(t)) : TRACK_BIT_NONE; } diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 19e390114..03c07bb40 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -324,7 +324,7 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec RoadTypes rts = GetRoadTypes(tile) & ComplementRoadTypes(RoadTypeToRoadTypes(rt)); if (rts == ROADTYPES_NONE) { TrackBits tracks = GetCrossingRailBits(tile); - bool reserved = GetCrossingReservation(tile); + bool reserved = HasCrossingReservation(tile); MakeRailNormal(tile, GetTileOwner(tile), tracks, GetRailType(tile)); if (reserved) SetTrackReservation(tile, tracks); } else { @@ -552,7 +552,7 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 Track railtrack = AxisToTrack(OtherAxis(roaddir)); YapfNotifyTrackLayoutChange(tile, railtrack); /* Always add road to the roadtypes (can't draw without it) */ - bool reserved = HasBit(GetTrackReservation(tile), railtrack); + bool reserved = HasBit(GetRailReservationTrackBits(tile), railtrack); MakeRoadCrossing(tile, _current_company, _current_company, GetTileOwner(tile), roaddir, GetRailType(tile), RoadTypeToRoadTypes(rt) | ROADTYPES_ROAD, p2); SetCrossingReservation(tile, reserved); UpdateLevelCrossing(tile, false); @@ -1170,7 +1170,7 @@ static void DrawTile_Road(TileInfo *ti) DrawGroundSprite(image, pal); /* PBS debugging, draw reserved tracks darker */ - if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && GetCrossingReservation(ti->tile)) { + if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasCrossingReservation(ti->tile)) { DrawGroundSprite(GetCrossingRoadAxis(ti->tile) == AXIS_Y ? GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.single_y : GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.single_x, PALETTE_CRASH); } diff --git a/src/road_map.h b/src/road_map.h index 0bd6d54a4..fbfb30dbb 100644 --- a/src/road_map.h +++ b/src/road_map.h @@ -219,7 +219,7 @@ static inline TrackBits GetCrossingRailBits(TileIndex tile) * @param t the crossing tile * @return reservation state */ -static inline bool GetCrossingReservation(TileIndex t) +static inline bool HasCrossingReservation(TileIndex t) { assert(IsLevelCrossingTile(t)); return HasBit(_m[t].m5, 4); @@ -244,9 +244,9 @@ static inline void SetCrossingReservation(TileIndex t, bool b) * @param t the tile * @return reserved track bits */ -static inline TrackBits GetRailCrossingReservation(TileIndex t) +static inline TrackBits GetCrossingReservationTrackBits(TileIndex t) { - return GetCrossingReservation(t) ? GetCrossingRailBits(t) : TRACK_BIT_NONE; + return HasCrossingReservation(t) ? GetCrossingRailBits(t) : TRACK_BIT_NONE; } static inline bool IsCrossingBarred(TileIndex t) diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index dfcdfc85f..d0d4c2b4d 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1019,7 +1019,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, DoCommandFlag flags, uin int w = plat_len; do { byte layout = *layout_ptr++; - if (IsRailwayStationTile(tile) && GetRailwayStationReservation(tile)) { + if (IsRailwayStationTile(tile) && HasStationReservation(tile)) { /* Check for trains having a reservation for this tile. */ Train *v = GetTrainForReservation(tile, AxisToTrack(GetRailStationAxis(tile))); if (v != NULL) { @@ -1201,7 +1201,7 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, DoCommandFlag flags, ui Owner owner = GetTileOwner(tile2); Train *v = NULL; - if (GetRailwayStationReservation(tile2)) { + if (HasStationReservation(tile2)) { v = GetTrainForReservation(tile2, track); if (v != NULL) { /* Free train reservation. */ @@ -1301,7 +1301,7 @@ static CommandCost RemoveRailroadStation(TileIndex tile, DoCommandFlag flags) Track track = GetRailStationTrack(tile); Owner owner = GetTileOwner(tile); // _current_company can be OWNER_WATER Train *v = NULL; - if (GetRailwayStationReservation(tile)) { + if (HasStationReservation(tile)) { v = GetTrainForReservation(tile, track); if (v != NULL) FreeTrainTrackReservation(v); } @@ -2304,7 +2304,7 @@ static void DrawTile_Station(TileInfo *ti) DrawGroundSprite(image, GroundSpritePaletteTransform(image, pal, palette)); /* PBS debugging, draw reserved tracks darker */ - if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && IsRailwayStation(ti->tile) && GetRailwayStationReservation(ti->tile)) { + if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && IsRailwayStation(ti->tile) && HasStationReservation(ti->tile)) { const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile)); DrawGroundSprite(GetRailStationAxis(ti->tile) == AXIS_X ? rti->base_sprites.single_y : rti->base_sprites.single_x, PALETTE_CRASH); } diff --git a/src/station_map.h b/src/station_map.h index 6c7d15026..a2bb5df66 100644 --- a/src/station_map.h +++ b/src/station_map.h @@ -218,7 +218,7 @@ static inline bool IsCompatibleTrainStationTile(TileIndex t1, TileIndex t2) * @param t the station tile * @return reservation state */ -static inline bool GetRailwayStationReservation(TileIndex t) +static inline bool HasStationReservation(TileIndex t) { assert(IsRailwayStationTile(t)); return HasBit(_m[t].m6, 2); @@ -242,9 +242,9 @@ static inline void SetRailwayStationReservation(TileIndex t, bool b) * @param t the tile * @return reserved track bits */ -static inline TrackBits GetRailStationReservation(TileIndex t) +static inline TrackBits GetStationReservationTrackBits(TileIndex t) { - return GetRailwayStationReservation(t) ? GetRailStationTrackBits(t) : TRACK_BIT_NONE; + return HasStationReservation(t) ? GetRailStationTrackBits(t) : TRACK_BIT_NONE; } diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 172ca934f..fb3f3c268 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1797,7 +1797,7 @@ void UpdateLevelCrossing(TileIndex tile, bool sound) assert(IsLevelCrossingTile(tile)); /* train on crossing || train approaching crossing || reserved */ - bool new_state = HasVehicleOnPos(tile, NULL, &TrainOnTileEnum) || TrainApproachingCrossing(tile) || GetCrossingReservation(tile); + bool new_state = HasVehicleOnPos(tile, NULL, &TrainOnTileEnum) || TrainApproachingCrossing(tile) || HasCrossingReservation(tile); if (new_state != IsCrossingBarred(tile)) { if (new_state && sound) { @@ -2459,7 +2459,7 @@ static bool CheckTrainStayInDepot(Train *v) v->load_unload_time_rem = 0; seg_state = _settings_game.pf.reserve_paths ? SIGSEG_PBS : UpdateSignalsOnSegment(v->tile, INVALID_DIAGDIR, v->owner); - if (seg_state == SIGSEG_FULL || GetDepotWaypointReservation(v->tile)) { + if (seg_state == SIGSEG_FULL || HasDepotWaypointReservation(v->tile)) { /* Full and no PBS signal in block or depot reserved, can't exit. */ InvalidateWindowClasses(WC_TRAINS_LIST); return true; @@ -2471,7 +2471,7 @@ static bool CheckTrainStayInDepot(Train *v) /* We are leaving a depot, but have to go to the exact same one; re-enter */ if (v->current_order.IsType(OT_GOTO_DEPOT) && v->tile == v->dest_tile) { /* We need to have a reservation for this to work. */ - if (GetDepotWaypointReservation(v->tile)) return true; + if (HasDepotWaypointReservation(v->tile)) return true; SetDepotWaypointReservation(v->tile, true); VehicleEnterDepot(v); return true; @@ -3137,7 +3137,7 @@ bool TryPathReserve(Train *v, bool mark_as_stuck, bool first_tile_okay) * at the depot tile itself but starts from the next tile. If we are still * inside the depot, a depot reservation can never be ours. */ if (v->track == TRACK_BIT_DEPOT) { - if (GetDepotWaypointReservation(v->tile)) { + if (HasDepotWaypointReservation(v->tile)) { if (mark_as_stuck) MarkTrainAsStuck(v); return false; } else { @@ -3892,7 +3892,7 @@ static void TrainController(Train *v, Vehicle *nomove) /* If we are approching a crossing that is reserved, play the sound now. */ TileIndex crossing = TrainApproachingCrossingTile(v); - if (crossing != INVALID_TILE && GetCrossingReservation(crossing)) SndPlayTileFx(SND_0E_LEVEL_CROSSING, crossing); + if (crossing != INVALID_TILE && HasCrossingReservation(crossing)) SndPlayTileFx(SND_0E_LEVEL_CROSSING, crossing); /* Always try to extend the reservation when entering a tile. */ CheckNextTrainTile(v); diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 908bb62e6..386b1b549 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -648,7 +648,7 @@ static CommandCost DoClearTunnel(TileIndex tile, DoCommandFlag flags) Owner owner = GetTileOwner(tile); Train *v = NULL; - if (GetTunnelBridgeReservation(tile)) { + if (HasTunnelBridgeReservation(tile)) { v = GetTrainForReservation(tile, track); if (v != NULL) FreeTrainTrackReservation(v); } @@ -713,7 +713,7 @@ static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags) uint height = GetBridgeHeight(tile); Train *v = NULL; - if (rail && GetTunnelBridgeReservation(tile)) { + if (rail && HasTunnelBridgeReservation(tile)) { v = GetTrainForReservation(tile, DiagDirToDiagTrack(direction)); if (v != NULL) FreeTrainTrackReservation(v); } @@ -919,7 +919,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti) DrawGroundSprite(image, PAL_NONE); /* PBS debugging, draw reserved tracks darker */ - if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && (transport_type == TRANSPORT_RAIL && GetTunnelBridgeReservation(ti->tile))) { + if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && (transport_type == TRANSPORT_RAIL && HasTunnelBridgeReservation(ti->tile))) { const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile)); DrawGroundSprite(DiagDirToAxis(tunnelbridge_direction) == AXIS_X ? rti->base_sprites.single_y : rti->base_sprites.single_x, PALETTE_CRASH); } @@ -1004,7 +1004,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti) /* Bridge heads are drawn solid no matter how invisibility/transparency is set */ AddSortableSpriteToDraw(psid->sprite, psid->pal, ti->x, ti->y, 16, 16, ti->tileh == SLOPE_FLAT ? 0 : 8, ti->z); - if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && transport_type == TRANSPORT_RAIL && GetTunnelBridgeReservation(ti->tile)) { + if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && transport_type == TRANSPORT_RAIL && HasTunnelBridgeReservation(ti->tile)) { const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile)); if (HasBridgeFlatRamp(ti->tileh, DiagDirToAxis(tunnelbridge_direction))) { AddSortableSpriteToDraw(DiagDirToAxis(tunnelbridge_direction) == AXIS_X ? rti->base_sprites.single_y : rti->base_sprites.single_x, PALETTE_CRASH, ti->x, ti->y, 16, 16, 0, ti->z + 8); diff --git a/src/tunnelbridge_map.h b/src/tunnelbridge_map.h index 5bb2a7465..aa68accba 100644 --- a/src/tunnelbridge_map.h +++ b/src/tunnelbridge_map.h @@ -88,7 +88,7 @@ static inline TileIndex GetOtherTunnelBridgeEnd(TileIndex t) * @param t the tile * @return reservation state */ -static inline bool GetTunnelBridgeReservation(TileIndex t) +static inline bool HasTunnelBridgeReservation(TileIndex t) { assert(IsTileType(t, MP_TUNNELBRIDGE)); assert(GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL); @@ -114,9 +114,9 @@ static inline void SetTunnelBridgeReservation(TileIndex t, bool b) * @param t the tile * @return reserved track bits */ -static inline TrackBits GetRailTunnelBridgeReservation(TileIndex t) +static inline TrackBits GetTunnelBridgeReservationTrackBits(TileIndex t) { - return GetTunnelBridgeReservation(t) ? DiagDirToDiagTrackBits(GetTunnelBridgeDirection(t)) : TRACK_BIT_NONE; + return HasTunnelBridgeReservation(t) ? DiagDirToDiagTrackBits(GetTunnelBridgeDirection(t)) : TRACK_BIT_NONE; } #endif /* TUNNELBRIDGE_MAP_H */ diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index cb6f3b767..1f82f17f0 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -185,7 +185,7 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1 } wp->owner = owner; - bool reserved = HasBit(GetTrackReservation(tile), AxisToTrack(axis)); + bool reserved = HasBit(GetRailReservationTrackBits(tile), AxisToTrack(axis)); MakeRailWaypoint(tile, owner, axis, GetRailType(tile), wp->index); SetDepotWaypointReservation(tile, reserved); MarkTileDirtyByTile(tile); @@ -234,12 +234,12 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justre Train *v = NULL; if (justremove) { TrackBits tracks = GetRailWaypointBits(tile); - bool reserved = GetDepotWaypointReservation(tile); + bool reserved = HasDepotWaypointReservation(tile); MakeRailNormal(tile, wp->owner, tracks, GetRailType(tile)); if (reserved) SetTrackReservation(tile, tracks); MarkTileDirtyByTile(tile); } else { - if (GetDepotWaypointReservation(tile)) { + if (HasDepotWaypointReservation(tile)) { v = GetTrainForReservation(tile, track); if (v != NULL) FreeTrainTrackReservation(v); } diff --git a/src/yapf/follow_track.hpp b/src/yapf/follow_track.hpp index cce1769e5..42646afea 100644 --- a/src/yapf/follow_track.hpp +++ b/src/yapf/follow_track.hpp @@ -137,7 +137,7 @@ struct CFollowTrackT /* Check skipped station tiles as well. */ TileIndexDiff diff = TileOffsByDiagDir(m_exitdir); for (TileIndex tile = m_new_tile - diff * m_tiles_skipped; tile != m_new_tile; tile += diff) { - if (GetRailwayStationReservation(tile)) { + if (HasStationReservation(tile)) { m_new_td_bits = TRACKDIR_BIT_NONE; m_err = EC_RESERVED; return false; diff --git a/src/yapf/yapf_costrail.hpp b/src/yapf/yapf_costrail.hpp index faf439ff2..dcf9a602a 100644 --- a/src/yapf/yapf_costrail.hpp +++ b/src/yapf/yapf_costrail.hpp @@ -153,7 +153,7 @@ public: { TileIndexDiff diff = TileOffsByDiagDir(TrackdirToExitdir(ReverseTrackdir(trackdir))); for (; skipped >= 0; skipped--, tile += diff) { - if (GetRailwayStationReservation(tile)) return true; + if (HasStationReservation(tile)) return true; } return false; } diff --git a/src/yapf/yapf_rail.cpp b/src/yapf/yapf_rail.cpp index d5a5f51a2..e6df394ea 100644 --- a/src/yapf/yapf_rail.cpp +++ b/src/yapf/yapf_rail.cpp @@ -69,7 +69,7 @@ private: TileIndexDiff diff = TileOffsByDiagDir(dir); do { - if (GetRailwayStationReservation(tile)) return false; + if (HasStationReservation(tile)) return false; SetRailwayStationReservation(tile, true); MarkTileDirtyByTile(tile); tile = TILE_ADD(tile, diff); |