From e08aa7e8e6bd732e66cd123aaa5c6885054bf68b Mon Sep 17 00:00:00 2001 From: terkhen Date: Tue, 9 Nov 2010 17:36:40 +0000 Subject: (svn r21121) -Fix (r21100): Use the cached max speed when calculating YAPF penalties for road vehicles. --- src/pathfinder/yapf/yapf_road.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/pathfinder') diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp index c06870173..446b84f24 100644 --- a/src/pathfinder/yapf/yapf_road.cpp +++ b/src/pathfinder/yapf/yapf_road.cpp @@ -140,9 +140,10 @@ public: /* add min/max speed penalties */ int min_speed = 0; + int max_veh_speed = v->GetDisplayMaxSpeed(); int max_speed = F.GetSpeedLimit(&min_speed); - if (max_speed < v->max_speed) segment_cost += 1 * (v->max_speed - max_speed); - if (min_speed > v->max_speed) segment_cost += 10 * (min_speed - v->max_speed); + if (max_speed < max_veh_speed) segment_cost += 1 * (max_veh_speed - max_speed); + if (min_speed > max_veh_speed) segment_cost += 10 * (min_speed - max_veh_speed); /* move to the next tile */ tile = F.m_new_tile; -- cgit v1.2.3-70-g09d2