summaryrefslogtreecommitdiff
path: root/src/pathfinder/yapf
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-11-09 17:36:40 +0000
committerterkhen <terkhen@openttd.org>2010-11-09 17:36:40 +0000
commite08aa7e8e6bd732e66cd123aaa5c6885054bf68b (patch)
tree1dda48a6843ab772d20eb7b12ee45c53d2e22a6d /src/pathfinder/yapf
parentc6ad6f52a9730f29dd48b8610c4c62d981886dfb (diff)
downloadopenttd-e08aa7e8e6bd732e66cd123aaa5c6885054bf68b.tar.xz
(svn r21121) -Fix (r21100): Use the cached max speed when calculating YAPF penalties for road vehicles.
Diffstat (limited to 'src/pathfinder/yapf')
-rw-r--r--src/pathfinder/yapf/yapf_road.cpp5
1 files changed, 3 insertions, 2 deletions
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;