diff options
author | rubidium <rubidium@openttd.org> | 2009-02-19 00:15:36 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-02-19 00:15:36 +0000 |
commit | c2d9c85c0fbb26b5db2ef20b7ac610e63de2b46b (patch) | |
tree | 76c1b93af5e93efa3bcc9984e1c04884640ea566 /src/yapf | |
parent | 336fda62bec39eb9ad1ee966a23faa0886a75309 (diff) | |
download | openttd-c2d9c85c0fbb26b5db2ef20b7ac610e63de2b46b.tar.xz |
(svn r15518) -Fix [FS#2631]: use distance to closest station tile as estimate for YAPF too (NPF already does so). This makes it behave 'better' with wide stations.
Diffstat (limited to 'src/yapf')
-rw-r--r-- | src/yapf/yapf_destrail.hpp | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/src/yapf/yapf_destrail.hpp b/src/yapf/yapf_destrail.hpp index 624e5b974..25db5ded1 100644 --- a/src/yapf/yapf_destrail.hpp +++ b/src/yapf/yapf_destrail.hpp @@ -115,25 +115,12 @@ protected: /// to access inherited path finder Tpf& Yapf() {return *static_cast<Tpf*>(this);} - static TileIndex CalcStationCenterTile(StationID station) - { - const Station *st = GetStation(station); - - /* If the rail station is (temporarily) not present, use the station sign to drive near the station */ - if (!IsValidTile(st->train_tile)) return st->xy; - - uint x = TileX(st->train_tile) + st->trainst_w / 2; - uint y = TileY(st->train_tile) + st->trainst_h / 2; - // return the tile of our target coordinates - return TileXY(x, y); - } - public: void SetDestination(const Vehicle *v) { switch (v->current_order.GetType()) { case OT_GOTO_STATION: - m_destTile = CalcStationCenterTile(v->current_order.GetDestination()); + m_destTile = CalcClosestStationTile(v->current_order.GetDestination(), v->tile); m_dest_station_id = v->current_order.GetDestination(); m_destTrackdirs = INVALID_TRACKDIR_BIT; break; |