summaryrefslogtreecommitdiff
path: root/src/pathfinder
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-05-21 15:53:02 +0000
committerrubidium <rubidium@openttd.org>2010-05-21 15:53:02 +0000
commitd8d37466afe02034fef2447a81fe4fe2469d352b (patch)
tree0fda73d691517ff84bc5d903284843a6bcf06b4d /src/pathfinder
parenta1b607a055034c1498ab82f985953694007c119b (diff)
downloadopenttd-d8d37466afe02034fef2447a81fe4fe2469d352b.tar.xz
(svn r19873) -Fix [FS#3817]: if the (guessed initial) destination tile of a road stop wasn't a road stop but was a T-junction or turn, the road vehicles would jump around in circles
Diffstat (limited to 'src/pathfinder')
-rw-r--r--src/pathfinder/yapf/yapf_road.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp
index 91a721da0..baed8d414 100644
--- a/src/pathfinder/yapf/yapf_road.cpp
+++ b/src/pathfinder/yapf/yapf_road.cpp
@@ -326,8 +326,11 @@ public:
FORCEINLINE Trackdir ChooseRoadTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir)
{
- /* handle special case - when next tile is destination tile */
- if (tile == v->dest_tile) {
+ /* Handle special case - when next tile is destination tile.
+ * However, when going to a station the (initial) destination
+ * tile might not be a station, but a junction, in which case
+ * this method forces the vehicle to jump in circles. */
+ if (tile == v->dest_tile && !v->current_order.IsType(OT_GOTO_STATION)) {
/* choose diagonal trackdir reachable from enterdir */
return DiagDirToDiagTrackdir(enterdir);
}