summaryrefslogtreecommitdiff
path: root/src/yapf
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-09-12 23:23:41 +0000
committerfrosch <frosch@openttd.org>2008-09-12 23:23:41 +0000
commitede0dd6a72006695697198c97bd52b4308e1f0b9 (patch)
treeaebcf086e6e12aed289dfd5818e7d8c281590521 /src/yapf
parentd7421cadd46625df686221105a9f0e7835d6f200 (diff)
downloadopenttd-ede0dd6a72006695697198c97bd52b4308e1f0b9.tar.xz
(svn r14305) -Fix [FS#2294] (r5033): [YAPF] Only reserve road slots for multistop when they are really reachable.
Diffstat (limited to 'src/yapf')
-rw-r--r--src/yapf/yapf_road.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/yapf/yapf_road.cpp b/src/yapf/yapf_road.cpp
index c9422c903..55ace4a12 100644
--- a/src/yapf/yapf_road.cpp
+++ b/src/yapf/yapf_road.cpp
@@ -322,14 +322,15 @@ public:
TrackdirBits dst_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(dst_tile, TRANSPORT_ROAD, v->u.road.compatible_roadtypes));
Yapf().SetDestination(dst_tile, dst_td_bits);
- // find the best path
- Yapf().FindPath(v);
-
// if path not found - return distance = UINT_MAX
uint dist = UINT_MAX;
+
+ // find the best path
+ if (!Yapf().FindPath(v)) return dist;
+
Node *pNode = Yapf().GetBestNode();
if (pNode != NULL) {
- // path was found or at least suggested
+ // path was found
// get the path cost estimate
dist = pNode->GetCostEstimate();
}