From 1647597943ecf5e1e8bf1370de3bd9385aa49296 Mon Sep 17 00:00:00 2001 From: frosch Date: Fri, 12 Sep 2008 23:23:41 +0000 Subject: (svn r14305) -Fix [FS#2294] (r5033): [YAPF] Only reserve road slots for multistop when they are really reachable. --- src/yapf/yapf_road.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') 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(); } -- cgit v1.2.3-54-g00ecf