summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKUDr <kudr@openttd.org>2007-04-29 09:55:32 +0000
committerKUDr <kudr@openttd.org>2007-04-29 09:55:32 +0000
commit027597f4854de4e9bb8ca21c9763bcd98af1d626 (patch)
tree387d487ba381b67144881b6faca22160b12ddb53
parent469c04478a028cbc03f2e313d3946b007b2e8854 (diff)
downloadopenttd-027597f4854de4e9bb8ca21c9763bcd98af1d626.tar.xz
(svn r9745) -Codechange [YAPF}: if destination is a waypoint then YAPF gets destination tile from that waypoint->xy instead of from v->dest_tile
-rw-r--r--src/yapf/yapf_destrail.hpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/yapf/yapf_destrail.hpp b/src/yapf/yapf_destrail.hpp
index 1baa62164..5b44d805c 100644
--- a/src/yapf/yapf_destrail.hpp
+++ b/src/yapf/yapf_destrail.hpp
@@ -86,14 +86,27 @@ protected:
public:
void SetDestination(Vehicle* v)
{
- if (v->current_order.type == OT_GOTO_STATION) {
- m_destTile = CalcStationCenterTile(v->current_order.dest);
- m_dest_station_id = v->current_order.dest;
- m_destTrackdirs = INVALID_TRACKDIR_BIT;
- } else {
- m_destTile = v->dest_tile;
- m_dest_station_id = INVALID_STATION;
- m_destTrackdirs = (TrackdirBits)(GetTileTrackStatus(v->dest_tile, TRANSPORT_RAIL) & TRACKDIR_BIT_MASK);
+ switch (v->current_order.type) {
+ case OT_GOTO_STATION:
+ m_destTile = CalcStationCenterTile(v->current_order.dest);
+ m_dest_station_id = v->current_order.dest;
+ m_destTrackdirs = INVALID_TRACKDIR_BIT;
+ break;
+
+ case OT_GOTO_WAYPOINT: {
+ Waypoint *wp = GetWaypoint(v->current_order.dest);
+ if (wp == NULL) break;
+ m_destTile = wp->xy;
+ m_dest_station_id = INVALID_STATION;
+ m_destTrackdirs = TrackToTrackdirBits(AxisToTrack(GetWaypointAxis(wp->xy)));
+ break;
+ }
+
+ default:
+ m_destTile = v->dest_tile;
+ m_dest_station_id = INVALID_STATION;
+ m_destTrackdirs = (TrackdirBits)(GetTileTrackStatus(v->dest_tile, TRANSPORT_RAIL) & TRACKDIR_BIT_MASK);
+ break;
}
CYapfDestinationRailBase::SetDestination(v);
}