diff options
author | rubidium <rubidium@openttd.org> | 2009-07-24 11:47:12 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-07-24 11:47:12 +0000 |
commit | cf38a5bee6628f4be58a1bd7774658cf86807d5c (patch) | |
tree | 2c2890dd002ff6aee0e4fc1905796b623a040153 | |
parent | 2c6b5237f68b1ce444f35eef6e31e7c0ff49d7cc (diff) | |
download | openttd-cf38a5bee6628f4be58a1bd7774658cf86807d5c.tar.xz |
(svn r16939) -Codechange: s/RailwayStation/RailStation/ to unify the way it's written.
-rw-r--r-- | src/ai/api/ai_rail.cpp | 2 | ||||
-rw-r--r-- | src/newgrf_station.cpp | 4 | ||||
-rw-r--r-- | src/npf.cpp | 10 | ||||
-rw-r--r-- | src/pbs.cpp | 14 | ||||
-rw-r--r-- | src/pbs.h | 2 | ||||
-rw-r--r-- | src/saveload/afterload.cpp | 8 | ||||
-rw-r--r-- | src/saveload/labelmaps_sl.cpp | 2 | ||||
-rw-r--r-- | src/saveload/waypoint_sl.cpp | 2 | ||||
-rw-r--r-- | src/station.cpp | 6 | ||||
-rw-r--r-- | src/station_base.h | 2 | ||||
-rw-r--r-- | src/station_cmd.cpp | 38 | ||||
-rw-r--r-- | src/station_map.h | 31 | ||||
-rw-r--r-- | src/train_cmd.cpp | 18 | ||||
-rw-r--r-- | src/waypoint_cmd.cpp | 2 | ||||
-rw-r--r-- | src/yapf/follow_track.hpp | 2 | ||||
-rw-r--r-- | src/yapf/yapf_costrail.hpp | 2 | ||||
-rw-r--r-- | src/yapf/yapf_destrail.hpp | 2 | ||||
-rw-r--r-- | src/yapf/yapf_rail.cpp | 12 |
18 files changed, 80 insertions, 79 deletions
diff --git a/src/ai/api/ai_rail.cpp b/src/ai/api/ai_rail.cpp index 766c23d53..edfe1441f 100644 --- a/src/ai/api/ai_rail.cpp +++ b/src/ai/api/ai_rail.cpp @@ -38,7 +38,7 @@ { if (!::IsValidTile(tile)) return false; - return ::IsRailwayStationTile(tile); + return ::IsRailStationTile(tile); } /* static */ bool AIRail::IsRailWaypointTile(TileIndex tile) diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 950af1892..581de2f0d 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -54,8 +54,8 @@ struct ETileArea : TileArea { Axis axis = GetRailStationAxis(tile); TileIndexDiff delta = TileOffsByDiagDir(AxisToDiagDir(axis)); - for (end = tile; IsRailwayStationTile(end + delta) && IsCompatibleTrainStationTile(tile, end + delta); end += delta) { /* Nothing */ } - for (start = tile; IsRailwayStationTile(start - delta) && IsCompatibleTrainStationTile(tile, start - delta); start -= delta) { /* Nothing */ } + for (end = tile; IsRailStationTile(end + delta) && IsCompatibleTrainStationTile(tile, end + delta); end += delta) { /* Nothing */ } + for (start = tile; IsRailStationTile(start - delta) && IsCompatibleTrainStationTile(tile, start - delta); start -= delta) { /* Nothing */ } this->tile = start; this->w = TileX(end) - TileX(start) + 1; diff --git a/src/npf.cpp b/src/npf.cpp index dbdd93ec4..dccb5a0cd 100644 --- a/src/npf.cpp +++ b/src/npf.cpp @@ -480,8 +480,8 @@ static void ClearPathReservation(const PathNode *start, const PathNode *end) { bool first_run = true; for (; start != end; start = start->parent) { - if (IsRailwayStationTile(start->node.tile) && first_run) { - SetRailwayStationPlatformReservation(start->node.tile, TrackdirToExitdir(start->node.direction), false); + if (IsRailStationTile(start->node.tile) && first_run) { + SetRailStationPlatformReservation(start->node.tile, TrackdirToExitdir(start->node.direction), false); } else { UnreserveRailTrack(start->node.tile, TrackdirToTrack(start->node.direction)); } @@ -512,7 +512,7 @@ static void NPFSaveTargetData(AyStar *as, OpenListNode *current) ftd->node = target->node; /* If the target is a station skip to platform end. */ - if (IsRailwayStationTile(target->node.tile)) { + if (IsRailStationTile(target->node.tile)) { DiagDirection dir = TrackdirToExitdir(target->node.direction); uint len = Station::GetByTile(target->node.tile)->GetPlatformLength(target->node.tile, dir); TileIndex end_tile = TILE_ADD(target->node.tile, (len - 1) * TileOffsByDiagDir(dir)); @@ -520,8 +520,8 @@ static void NPFSaveTargetData(AyStar *as, OpenListNode *current) /* Update only end tile, trackdir of a station stays the same. */ ftd->node.tile = end_tile; if (!IsWaitingPositionFree(v, end_tile, target->node.direction, _settings_game.pf.forbid_90_deg)) return; - SetRailwayStationPlatformReservation(target->node.tile, dir, true); - SetRailwayStationReservation(target->node.tile, false); + SetRailStationPlatformReservation(target->node.tile, dir, true); + SetRailStationReservation(target->node.tile, false); } else { if (!IsWaitingPositionFree(v, target->node.tile, target->node.direction, _settings_game.pf.forbid_90_deg)) return; } diff --git a/src/pbs.cpp b/src/pbs.cpp index 32440f914..9b85ed9e7 100644 --- a/src/pbs.cpp +++ b/src/pbs.cpp @@ -41,21 +41,21 @@ TrackBits GetReservedTrackbits(TileIndex t) /** * Set the reservation for a complete station platform. - * @pre IsRailwayStationTile(start) + * @pre IsRailStationTile(start) * @param start starting tile of the platform * @param dir the direction in which to follow the platform * @param b the state the reservation should be set to */ -void SetRailwayStationPlatformReservation(TileIndex start, DiagDirection dir, bool b) +void SetRailStationPlatformReservation(TileIndex start, DiagDirection dir, bool b) { TileIndex tile = start; TileIndexDiff diff = TileOffsByDiagDir(dir); - assert(IsRailwayStationTile(start)); + assert(IsRailStationTile(start)); assert(GetRailStationAxis(start) == DiagDirToAxis(dir)); do { - SetRailwayStationReservation(tile, b); + SetRailStationReservation(tile, b); MarkTileDirtyByTile(tile); tile = TILE_ADD(tile, diff); } while (IsCompatibleTrainStationTile(tile, start)); @@ -100,7 +100,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t) case MP_STATION: if (HasStationRail(tile) && !HasStationReservation(tile)) { - SetRailwayStationReservation(tile, true); + SetRailStationReservation(tile, true); MarkTileDirtyByTile(tile); // some GRFs need redraw after reserving track return true; } @@ -151,7 +151,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t) case MP_STATION: if (HasStationRail(tile)) { - SetRailwayStationReservation(tile, false); + SetRailStationReservation(tile, false); MarkTileDirtyByTile(tile); } break; @@ -295,7 +295,7 @@ Train *GetTrainForReservation(TileIndex tile, Track track) if (ftoti.best != NULL) return ftoti.best; /* Special case for stations: check the whole platform for a vehicle. */ - if (IsRailwayStationTile(ftoti.res.tile)) { + if (IsRailStationTile(ftoti.res.tile)) { TileIndexDiff diff = TileOffsByDiagDir(TrackdirToExitdir(ReverseTrackdir(ftoti.res.trackdir))); for (TileIndex st_tile = ftoti.res.tile + diff; IsCompatibleTrainStationTile(st_tile, ftoti.res.tile); st_tile += diff) { FindVehicleOnPos(st_tile, &ftoti, FindTrainOnTrackEnum); @@ -12,7 +12,7 @@ TrackBits GetReservedTrackbits(TileIndex t); -void SetRailwayStationPlatformReservation(TileIndex start, DiagDirection dir, bool b); +void SetRailStationPlatformReservation(TileIndex start, DiagDirection dir, bool b); bool TryReserveRailTrack(TileIndex tile, Track t); void UnreserveRailTrack(TileIndex tile, Track t); diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 3326bc53e..5f99ca61b 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -561,7 +561,7 @@ bool AfterLoadGame() if (HasBit(_m[t].m6, 3)) SetBit(_m[t].m6, 2); StationGfx gfx = GetStationGfx(t); StationType st; - if ( IsInsideMM(gfx, 0, 8)) { // Railway station + if ( IsInsideMM(gfx, 0, 8)) { // Rail station st = STATION_RAIL; SetStationGfx(t, gfx - 0); } else if (IsInsideMM(gfx, 8, 67)) { // Airport @@ -573,13 +573,13 @@ bool AfterLoadGame() } else if (IsInsideMM(gfx, 71, 75)) { // Bus st = STATION_BUS; SetStationGfx(t, gfx - 71); - } else if (gfx == 75) { // Oil rig + } else if (gfx == 75) { // Oil rig st = STATION_OILRIG; SetStationGfx(t, gfx - 75); } else if (IsInsideMM(gfx, 76, 82)) { // Dock st = STATION_DOCK; SetStationGfx(t, gfx - 76); - } else if (gfx == 82) { // Buoy + } else if (gfx == 82) { // Buoy st = STATION_BUOY; SetStationGfx(t, gfx - 82); } else if (IsInsideMM(gfx, 83, 168)) { // Extended airport @@ -1654,7 +1654,7 @@ bool AfterLoadGame() break; case MP_STATION: // Clear PBS reservation on station - if (IsRailwayStation(t)) SetRailwayStationReservation(t, false); + if (HasStationRail(t)) SetRailStationReservation(t, false); break; case MP_TUNNELBRIDGE: // Clear PBS reservation on tunnels/birdges diff --git a/src/saveload/labelmaps_sl.cpp b/src/saveload/labelmaps_sl.cpp index f216b8333..274b735ff 100644 --- a/src/saveload/labelmaps_sl.cpp +++ b/src/saveload/labelmaps_sl.cpp @@ -64,7 +64,7 @@ void AfterLoadLabelMaps() break; case MP_STATION: - if (IsRailwayStation(t)) { + if (HasStationRail(t)) { SetRailType(t, railtype_conversion_map[GetRailType(t)]); } break; diff --git a/src/saveload/waypoint_sl.cpp b/src/saveload/waypoint_sl.cpp index 04cbfd577..728537258 100644 --- a/src/saveload/waypoint_sl.cpp +++ b/src/saveload/waypoint_sl.cpp @@ -104,7 +104,7 @@ void MoveWaypointsToBaseStations() new_wp->facilities |= FACIL_TRAIN; new_wp->owner = GetTileOwner(t); - SetRailwayStationReservation(t, reserved); + SetRailStationReservation(t, reserved); if (wp->spec != NULL) { SetCustomStationSpecIndex(t, AllocateSpecToStation(wp->spec, new_wp, true)); diff --git a/src/station.cpp b/src/station.cpp index 456862d38..0f2555ffb 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -182,7 +182,7 @@ void Station::MarkTilesDirty(bool cargo_change) const } /** Obtain the length of a platform - * @pre tile must be a railway station tile + * @pre tile must be a rail station tile * @param tile A tile that contains the platform in question * @return The length of the platform */ @@ -210,7 +210,7 @@ uint Station::GetPlatformLength(TileIndex tile) const /** Determines the REMAINING length of a platform, starting at (and including) * the given tile. - * @param tile the tile from which to start searching. Must be a railway station tile + * @param tile the tile from which to start searching. Must be a rail station tile * @param dir The direction in which to search. * @return The platform length */ @@ -218,7 +218,7 @@ uint Station::GetPlatformLength(TileIndex tile, DiagDirection dir) const { TileIndex start_tile = tile; uint length = 0; - assert(IsRailwayStationTile(tile)); + assert(IsRailStationTile(tile)); assert(dir < DIAGDIR_END); do { diff --git a/src/station_base.h b/src/station_base.h index 772c204e3..d9c7369b3 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -133,7 +133,7 @@ public: /* virtual */ FORCEINLINE bool TileBelongsToRailStation(TileIndex tile) const { - return IsRailwayStationTile(tile) && GetStationIndex(tile) == this->index; + return IsRailStationTile(tile) && GetStationIndex(tile) == this->index; } /* virtual */ uint32 GetNewGRFVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) const; diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 5854ba489..4df28f410 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -700,7 +700,7 @@ CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, DoCommandFlag fla * so station points to INVALID_STATION if we can build on any station. * Or it points to a station if we're only allowed to build on exactly that station. */ if (station != NULL && IsTileType(tile_cur, MP_STATION)) { - if (!IsRailwayStation(tile_cur)) { + if (!IsRailStation(tile_cur)) { return ClearTile_Station(tile_cur, DC_AUTO); // get error message } else { StationID st = GetStationIndex(tile_cur); @@ -1013,15 +1013,15 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, DoCommandFlag flags, uin int w = plat_len; do { byte layout = *layout_ptr++; - if (IsRailwayStationTile(tile) && HasStationReservation(tile)) { + if (IsRailStationTile(tile) && HasStationReservation(tile)) { /* Check for trains having a reservation for this tile. */ Train *v = GetTrainForReservation(tile, AxisToTrack(GetRailStationAxis(tile))); if (v != NULL) { FreeTrainTrackReservation(v); *affected_vehicles.Append() = v; - if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), false); + if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), false); for (; v->Next() != NULL; v = v->Next()) ; - if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(ReverseTrackdir(v->GetVehicleTrackdir())), false); + if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(ReverseTrackdir(v->GetVehicleTrackdir())), false); } } @@ -1058,10 +1058,10 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, DoCommandFlag flags, uin for (uint i = 0; i < affected_vehicles.Length(); ++i) { /* Restore reservations of trains. */ Train *v = affected_vehicles[i]; - if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), true); + if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), true); TryPathReserve(v, true, true); for (; v->Next() != NULL; v = v->Next()) ; - if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(ReverseTrackdir(v->GetVehicleTrackdir())), true); + if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(ReverseTrackdir(v->GetVehicleTrackdir())), true); } st->MarkTilesDirty(false); @@ -1076,7 +1076,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, DoCommandFlag flags, uin return cost; } -static void MakeRailwayStationAreaSmaller(Station *st) +static void MakeRailStationAreaSmaller(Station *st) { uint w = st->trainst_w; uint h = st->trainst_h; @@ -1165,7 +1165,7 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, DoCommandFlag flags, ui /* Do the action for every tile into the area */ BEGIN_TILE_LOOP(tile2, size_x, size_y, tile) { /* Make sure the specified tile is a railroad station */ - if (!IsRailwayStationTile(tile2)) { + if (!IsRailStationTile(tile2)) { continue; } @@ -1200,10 +1200,10 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, DoCommandFlag flags, ui if (v != NULL) { /* Free train reservation. */ FreeTrainTrackReservation(v); - if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), false); + if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), false); Vehicle *temp = v; for (; temp->Next() != NULL; temp = temp->Next()) ; - if (IsRailwayStationTile(temp->tile)) SetRailwayStationPlatformReservation(temp->tile, TrackdirToExitdir(ReverseTrackdir(temp->GetVehicleTrackdir())), false); + if (IsRailStationTile(temp->tile)) SetRailStationPlatformReservation(temp->tile, TrackdirToExitdir(ReverseTrackdir(temp->GetVehicleTrackdir())), false); } } @@ -1218,10 +1218,10 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, DoCommandFlag flags, ui if (v != NULL) { /* Restore station reservation. */ - if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), true); + if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), true); TryPathReserve(v, true, true); for (; v->Next() != NULL; v = v->Next()) ; - if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(ReverseTrackdir(v->GetVehicleTrackdir())), true); + if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(ReverseTrackdir(v->GetVehicleTrackdir())), true); } } } END_TILE_LOOP(tile2, size_x, size_y, tile) @@ -1232,7 +1232,7 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, DoCommandFlag flags, ui /* now we need to make the "spanned" area of the railway station smaller * if we deleted something at the edges. * we also need to adjust train_tile. */ - MakeRailwayStationAreaSmaller(st); + MakeRailStationAreaSmaller(st); st->MarkTilesDirty(false); UpdateStationSignCoord(st); @@ -2135,7 +2135,7 @@ static void DrawTile_Station(TileInfo *ti) int32 total_offset; int32 custom_ground_offset; - if (IsRailwayStation(ti->tile) || IsRailWaypoint(ti->tile)) { + if (HasStationRail(ti->tile)) { const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile)); roadtypes = ROADTYPES_NONE; total_offset = rti->total_offset; @@ -2212,13 +2212,13 @@ 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) || IsRailWaypoint(ti->tile)) && HasStationReservation(ti->tile)) { + if (_game_mode != GM_MENU && _settings_client.gui.show_track_reservation && HasStationRail(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); } } - if ((IsRailwayStation(ti->tile) || IsRailWaypoint(ti->tile)) && HasCatenaryDrawn(GetRailType(ti->tile)) && IsStationTileElectrifiable(ti->tile)) DrawCatenary(ti); + if (HasStationRail(ti->tile) && HasCatenaryDrawn(GetRailType(ti->tile)) && IsStationTileElectrifiable(ti->tile)) DrawCatenary(ti); if (HasBit(roadtypes, ROADTYPE_TRAM)) { Axis axis = GetRoadStopDir(ti->tile) == DIAGDIR_NE ? AXIS_X : AXIS_Y; @@ -2359,7 +2359,7 @@ static TrackStatus GetTileTrackStatus_Station(TileIndex tile, TransportType mode switch (mode) { case TRANSPORT_RAIL: - if ((IsRailwayStation(tile) || IsRailWaypoint(tile)) && !IsStationTileBlocked(tile)) { + if (HasStationRail(tile) && !IsStationTileBlocked(tile)) { trackbits = TrackToTrackBits(GetRailStationTrack(tile)); } break; @@ -2444,7 +2444,7 @@ static void AnimateTile_Station(TileIndex tile) { GFX_WINDSACK_INTERCON_FIRST, GFX_WINDSACK_INTERCON_LAST, 1 } }; - if (IsRailwayStation(tile)) { + if (HasStationRail(tile)) { AnimateStationTile(tile); return; } @@ -2483,7 +2483,7 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i if (v->type == VEH_TRAIN) { if (!v->current_order.ShouldStopAtStation(v, station_id)) return VETSB_CONTINUE; - if (!IsRailwayStation(tile) || !Train::From(v)->IsFrontEngine()) return VETSB_CONTINUE; + if (!IsRailStation(tile) || !Train::From(v)->IsFrontEngine()) return VETSB_CONTINUE; int station_ahead; int station_length; diff --git a/src/station_map.h b/src/station_map.h index b93154899..fc38198ea 100644 --- a/src/station_map.h +++ b/src/station_map.h @@ -45,6 +45,7 @@ enum { static inline StationType GetStationType(TileIndex t) { + assert(IsTileType(t, MP_STATION)); return (StationType)GB(_m[t].m6, 3, 3); } @@ -78,14 +79,14 @@ static inline void SetStationAnimationFrame(TileIndex t, uint8 frame) _me[t].m7 = frame; } -static inline bool IsRailwayStation(TileIndex t) +static inline bool IsRailStation(TileIndex t) { return GetStationType(t) == STATION_RAIL; } -static inline bool IsRailwayStationTile(TileIndex t) +static inline bool IsRailStationTile(TileIndex t) { - return IsTileType(t, MP_STATION) && IsRailwayStation(t); + return IsTileType(t, MP_STATION) && IsRailStation(t); } /** @@ -118,7 +119,7 @@ static inline bool IsRailWaypointTile(TileIndex t) */ static inline bool HasStationRail(TileIndex t) { - return IsRailwayStation(t) || IsRailWaypoint(t); + return IsRailStation(t) || IsRailWaypoint(t); } /** @@ -230,7 +231,7 @@ static inline bool IsHangarTile(TileIndex t) static inline Axis GetRailStationAxis(TileIndex t) { - assert(IsRailwayStation(t) || IsRailWaypoint(t)); + assert(HasStationRail(t)); return HasBit(GetStationGfx(t), 0) ? AXIS_Y : AXIS_X; } @@ -247,9 +248,9 @@ static inline TrackBits GetRailStationTrackBits(TileIndex t) static inline bool IsCompatibleTrainStationTile(TileIndex t1, TileIndex t2) { - assert(IsRailwayStationTile(t2)); + assert(IsRailStationTile(t2)); return - IsRailwayStationTile(t1) && + IsRailStationTile(t1) && IsCompatibleRail(GetRailType(t1), GetRailType(t2)) && GetRailStationAxis(t1) == GetRailStationAxis(t2) && GetStationIndex(t1) == GetStationIndex(t2) && @@ -258,31 +259,31 @@ static inline bool IsCompatibleTrainStationTile(TileIndex t1, TileIndex t2) /** * Get the reservation state of the rail station - * @pre IsRailwayStation(t) || IsRailWaypoint(t) + * @pre HasStationRail(t) * @param t the station tile * @return reservation state */ static inline bool HasStationReservation(TileIndex t) { - assert(IsRailwayStation(t) || IsRailWaypoint(t)); + assert(HasStationRail(t)); return HasBit(_m[t].m6, 2); } /** * Set the reservation state of the rail station - * @pre IsRailwayStation(t) || IsRailWaypoint(t) + * @pre HasStationRail(t) * @param t the station tile * @param b the reservation state */ -static inline void SetRailwayStationReservation(TileIndex t, bool b) +static inline void SetRailStationReservation(TileIndex t, bool b) { - assert(IsRailwayStation(t) || IsRailWaypoint(t)); + assert(HasStationRail(t)); SB(_m[t].m6, 2, 1, b ? 1 : 0); } /** * Get the reserved track bits for a waypoint - * @pre IsRailwayStation(t) || IsRailWaypoint(t) + * @pre HasStationRail(t) * @param t the tile * @return reserved track bits */ @@ -366,14 +367,14 @@ static inline void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a, { MakeStation(t, o, sid, STATION_RAIL, section + a); SetRailType(t, rt); - SetRailwayStationReservation(t, false); + SetRailStationReservation(t, false); } static inline void MakeRailWaypoint(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt) { MakeStation(t, o, sid, STATION_WAYPOINT, section + a); SetRailType(t, rt); - SetRailwayStationReservation(t, false); + SetRailStationReservation(t, false); } static inline void MakeRoadStop(TileIndex t, Owner o, StationID sid, RoadStopType rst, RoadTypes rt, DiagDirection d) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index b954a0337..b4a43560c 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -482,7 +482,7 @@ static int GetTrainAcceleration(Train *v, bool mode) assert(max_speed == GetTrainCurveSpeedLimit(v)); // safety check, will be removed later int speed = v->cur_speed * 10 / 16; // km-ish/h -> mp/h - if (IsRailwayStationTile(v->tile) && v->IsFrontEngine()) { + if (IsRailStationTile(v->tile) && v->IsFrontEngine()) { StationID sid = GetStationIndex(v->tile); if (v->current_order.ShouldStopAtStation(v, sid)) { int station_ahead; @@ -1977,7 +1977,7 @@ static void ReverseTrainDirection(Train *v) HasSignalOnTrackdir(v->tile, v->GetVehicleTrackdir()) && !IsPbsSignal(GetSignalType(v->tile, FindFirstTrack(v->track)))); - if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), true); + if (IsRailStationTile(v->tile)) SetRailStationPlatformReservation(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), true); if (TryPathReserve(v, false, first_tile_okay)) { /* Do a look-ahead now in case our current tile was already a safe tile. */ CheckNextTrainTile(v); @@ -2404,7 +2404,7 @@ static void CheckNextTrainTile(Train *v) /* Exit if we reached our destination depot or are inside a depot. */ if ((v->tile == v->dest_tile && v->current_order.IsType(OT_GOTO_DEPOT)) || v->track == TRACK_BIT_DEPOT) return; /* Exit if we are on a station tile and are going to stop. */ - if (IsRailwayStationTile(v->tile) && v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile))) return; + if (IsRailStationTile(v->tile) && v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile))) return; /* Exit if the current order doesn't have a destination, but the train has orders. */ if ((v->current_order.IsType(OT_NOTHING) || v->current_order.IsType(OT_LEAVESTATION) || v->current_order.IsType(OT_LOADING)) && v->GetNumOrders() > 0) return; @@ -2529,12 +2529,12 @@ static void ClearPathReservation(const Train *v, TileIndex tile, Trackdir track_ } } } - } else if (IsRailwayStationTile(tile)) { + } else if (IsRailStationTile(tile)) { TileIndex new_tile = TileAddByDiagDir(tile, dir); /* If the new tile is not a further tile of the same station, we * clear the reservation for the whole platform. */ if (!IsCompatibleTrainStationTile(new_tile, tile)) { - SetRailwayStationPlatformReservation(tile, ReverseDiagDir(dir), false); + SetRailStationPlatformReservation(tile, ReverseDiagDir(dir), false); } } else { /* Any other tile */ @@ -2549,8 +2549,8 @@ void FreeTrainTrackReservation(const Train *v, TileIndex origin, Trackdir orig_t TileIndex tile = origin != INVALID_TILE ? origin : v->tile; Trackdir td = orig_td != INVALID_TRACKDIR ? orig_td : v->GetVehicleTrackdir(); - bool free_tile = tile != v->tile || !(IsRailwayStationTile(v->tile) || IsTileType(v->tile, MP_TUNNELBRIDGE)); - StationID station_id = IsRailwayStationTile(v->tile) ? GetStationIndex(v->tile) : INVALID_STATION; + bool free_tile = tile != v->tile || !(IsRailStationTile(v->tile) || IsTileType(v->tile, MP_TUNNELBRIDGE)); + StationID station_id = IsRailStationTile(v->tile) ? GetStationIndex(v->tile) : INVALID_STATION; /* Don't free reservation if it's not ours. */ if (TracksOverlap(GetReservedTrackbits(tile) | TrackToTrackBits(TrackdirToTrack(td)))) return; @@ -2607,7 +2607,7 @@ static bool NtpCallbFindStation(TileIndex tile, TrainTrackFollowerData *ttfd, Tr /* did we reach the final station? */ if ((ttfd->station_index == INVALID_STATION && tile == ttfd->dest_coords) || ( - IsRailwayStationTile(tile) && + IsRailStationTile(tile) && GetStationIndex(tile) == ttfd->station_index )) { /* We do not check for dest_coords if we have a station_index, @@ -3010,7 +3010,7 @@ static Track ChooseTrainTrack(Train *v, TileIndex tile, DiagDirection enterdir, orders.SwitchToNextOrder(false); } else if (v->current_order.IsType(OT_LOADING) || (!v->current_order.IsType(OT_GOTO_DEPOT) && ( v->current_order.IsType(OT_GOTO_STATION) ? - IsRailwayStationTile(v->tile) && v->current_order.GetDestination() == GetStationIndex(v->tile) : + IsRailStationTile(v->tile) && v->current_order.GetDestination() == GetStationIndex(v->tile) : v->tile == v->dest_tile))) { orders.SwitchToNextOrder(true); } diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index 96dd5fc74..29880a761 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -186,7 +186,7 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1 bool reserved = HasBit(GetRailReservationTrackBits(tile), AxisToTrack(axis)); MakeRailWaypoint(tile, owner, wp->index, axis, 0, GetRailType(tile)); - SetRailwayStationReservation(tile, reserved); + SetRailStationReservation(tile, reserved); MarkTileDirtyByTile(tile); SetCustomStationSpecIndex(tile, AllocateSpecToStation(GetCustomStationSpec(STAT_CLASS_WAYP, p1), wp, true)); diff --git a/src/yapf/follow_track.hpp b/src/yapf/follow_track.hpp index 42646afea..5d0a1e83b 100644 --- a/src/yapf/follow_track.hpp +++ b/src/yapf/follow_track.hpp @@ -191,7 +191,7 @@ protected: m_new_tile = TILE_ADD(m_old_tile, diff); /* special handling for stations */ - if (IsRailTT() && IsRailwayStationTile(m_new_tile)) { + if (IsRailTT() && IsRailStationTile(m_new_tile)) { m_is_station = true; } else if (IsRoadTT() && IsRoadStopTile(m_new_tile)) { m_is_station = true; diff --git a/src/yapf/yapf_costrail.hpp b/src/yapf/yapf_costrail.hpp index 1731f7fdf..cda82f1d7 100644 --- a/src/yapf/yapf_costrail.hpp +++ b/src/yapf/yapf_costrail.hpp @@ -163,7 +163,7 @@ public: { if (n.m_num_signals_passed >= m_sig_look_ahead_costs.Size() / 2) return 0; - if (IsRailwayStationTile(tile) && IsAnyStationTileReserved(tile, trackdir, skipped)) { + if (IsRailStationTile(tile) && IsAnyStationTileReserved(tile, trackdir, skipped)) { return Yapf().PfGetSettings().rail_pbs_station_penalty * (skipped + 1); } else if (TrackOverlapsTracks(GetReservedTrackbits(tile), TrackdirToTrack(trackdir))) { int cost = Yapf().PfGetSettings().rail_pbs_cross_penalty; diff --git a/src/yapf/yapf_destrail.hpp b/src/yapf/yapf_destrail.hpp index 650b43b49..928f10065 100644 --- a/src/yapf/yapf_destrail.hpp +++ b/src/yapf/yapf_destrail.hpp @@ -160,7 +160,7 @@ public: { bool bDest; if (m_dest_station_id != INVALID_STATION) { - bDest = IsRailwayStationTile(tile) + bDest = IsRailStationTile(tile) && (GetStationIndex(tile) == m_dest_station_id) && (GetRailStationTrack(tile) == TrackdirToTrack(td)); } else { diff --git a/src/yapf/yapf_rail.cpp b/src/yapf/yapf_rail.cpp index e6df394ea..89ffa8cbf 100644 --- a/src/yapf/yapf_rail.cpp +++ b/src/yapf/yapf_rail.cpp @@ -63,14 +63,14 @@ private: } /** Reserve a railway platform. Tile contains the failed tile on abort. */ - bool ReserveRailwayStationPlatform(TileIndex &tile, DiagDirection dir) + bool ReserveRailStationPlatform(TileIndex &tile, DiagDirection dir) { TileIndex start = tile; TileIndexDiff diff = TileOffsByDiagDir(dir); do { if (HasStationReservation(tile)) return false; - SetRailwayStationReservation(tile, true); + SetRailStationReservation(tile, true); MarkTileDirtyByTile(tile); tile = TILE_ADD(tile, diff); } while (IsCompatibleTrainStationTile(tile, start)); @@ -81,8 +81,8 @@ private: /** Try to reserve a single track/platform. */ bool ReserveSingleTrack(TileIndex tile, Trackdir td) { - if (IsRailwayStationTile(tile)) { - if (!ReserveRailwayStationPlatform(tile, TrackdirToExitdir(ReverseTrackdir(td)))) { + if (IsRailStationTile(tile)) { + if (!ReserveRailStationPlatform(tile, TrackdirToExitdir(ReverseTrackdir(td)))) { /* Platform could not be reserved, undo. */ m_res_fail_tile = tile; m_res_fail_td = td; @@ -102,11 +102,11 @@ private: /** Unreserve a single track/platform. Stops when the previous failer is reached. */ bool UnreserveSingleTrack(TileIndex tile, Trackdir td) { - if (IsRailwayStationTile(tile)) { + if (IsRailStationTile(tile)) { TileIndex start = tile; TileIndexDiff diff = TileOffsByDiagDir(TrackdirToExitdir(ReverseTrackdir(td))); while ((tile != m_res_fail_tile || td != m_res_fail_td) && IsCompatibleTrainStationTile(tile, start)) { - SetRailwayStationReservation(tile, false); + SetRailStationReservation(tile, false); tile = TILE_ADD(tile, diff); } } else if (tile != m_res_fail_tile || td != m_res_fail_td) { |