diff options
author | rubidium <rubidium@openttd.org> | 2009-07-24 15:18:25 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-07-24 15:18:25 +0000 |
commit | c3d2c47faa6bb9c07c362127b4fb5de79130bfa0 (patch) | |
tree | 6478960a00fd8d58956b9fdb0981ad1bf995f373 /src/yapf | |
parent | cf38a5bee6628f4be58a1bd7774658cf86807d5c (diff) | |
download | openttd-c3d2c47faa6bb9c07c362127b4fb5de79130bfa0.tar.xz |
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
Diffstat (limited to 'src/yapf')
-rw-r--r-- | src/yapf/follow_track.hpp | 4 | ||||
-rw-r--r-- | src/yapf/yapf_costrail.hpp | 2 | ||||
-rw-r--r-- | src/yapf/yapf_destrail.hpp | 9 |
3 files changed, 5 insertions, 10 deletions
diff --git a/src/yapf/follow_track.hpp b/src/yapf/follow_track.hpp index 5d0a1e83b..8b2c27066 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() && IsRailStationTile(m_new_tile)) { + if (IsRailTT() && HasStationTileRail(m_new_tile)) { m_is_station = true; } else if (IsRoadTT() && IsRoadStopTile(m_new_tile)) { m_is_station = true; @@ -346,7 +346,7 @@ protected: if (IsRailTT() && m_is_station) { /* entered railway station * get platform length */ - uint length = Station::GetByTile(m_new_tile)->GetPlatformLength(m_new_tile, TrackdirToExitdir(m_old_td)); + uint length = BaseStation::GetByTile(m_new_tile)->GetPlatformLength(m_new_tile, TrackdirToExitdir(m_old_td)); /* how big step we must do to get to the last platform tile; */ m_tiles_skipped = length - 1; /* move to the platform end */ diff --git a/src/yapf/yapf_costrail.hpp b/src/yapf/yapf_costrail.hpp index cda82f1d7..7c0f522a7 100644 --- a/src/yapf/yapf_costrail.hpp +++ b/src/yapf/yapf_costrail.hpp @@ -543,7 +543,7 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th /* Station platform-length penalty. */ if ((end_segment_reason & ESRB_STATION) != ESRB_NONE) { - Station *st = Station::GetByTile(n.GetLastTile()); + const BaseStation *st = BaseStation::GetByTile(n.GetLastTile()); assert(st != NULL); uint platform_length = st->GetPlatformLength(n.GetLastTile(), ReverseDiagDir(TrackdirToExitdir(n.GetLastTrackdir()))); /* Reduce the extra cost caused by passing-station penalty (each station receives it in the segment cost). */ diff --git a/src/yapf/yapf_destrail.hpp b/src/yapf/yapf_destrail.hpp index 928f10065..dea651789 100644 --- a/src/yapf/yapf_destrail.hpp +++ b/src/yapf/yapf_destrail.hpp @@ -129,17 +129,12 @@ public: { switch (v->current_order.GetType()) { case OT_GOTO_STATION: + case OT_GOTO_WAYPOINT: m_destTile = CalcClosestStationTile(v->current_order.GetDestination(), v->tile); m_dest_station_id = v->current_order.GetDestination(); m_destTrackdirs = INVALID_TRACKDIR_BIT; break; - case OT_GOTO_WAYPOINT: - m_destTile = Waypoint::Get(v->current_order.GetDestination())->xy; - m_dest_station_id = INVALID_STATION; - m_destTrackdirs = IsRailWaypointTile(m_destTile) ? TrackToTrackdirBits(GetRailStationTrack(m_destTile)) : INVALID_TRACKDIR_BIT; - break; - default: m_destTile = v->dest_tile; m_dest_station_id = INVALID_STATION; @@ -160,7 +155,7 @@ public: { bool bDest; if (m_dest_station_id != INVALID_STATION) { - bDest = IsRailStationTile(tile) + bDest = HasStationTileRail(tile) && (GetStationIndex(tile) == m_dest_station_id) && (GetRailStationTrack(tile) == TrackdirToTrack(td)); } else { |