summaryrefslogtreecommitdiff
path: root/src/pathfinder
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2010-11-07 13:35:12 +0000
committermichi_cc <michi_cc@openttd.org>2010-11-07 13:35:12 +0000
commitb26b8b5b2abbeb29bc7dffb71198405c742b1aee (patch)
treeeca88fa3a589c20246031bf51049ed2081d9c836 /src/pathfinder
parent2d801c64a1d8ce0cf3f4f106d77c47fea33bbd4d (diff)
downloadopenttd-b26b8b5b2abbeb29bc7dffb71198405c742b1aee.tar.xz
(svn r21107) -Fix: Don't use the maximum track speed where the maximum vehicle speed is meant.
Diffstat (limited to 'src/pathfinder')
-rw-r--r--src/pathfinder/yapf/yapf_costrail.hpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp
index fe025ee26..1de6eba78 100644
--- a/src/pathfinder/yapf/yapf_costrail.hpp
+++ b/src/pathfinder/yapf/yapf_costrail.hpp
@@ -466,11 +466,12 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
{
int min_speed = 0;
int max_speed = tf->GetSpeedLimit(&min_speed);
- if (max_speed < v->max_speed) {
- extra_cost += YAPF_TILE_LENGTH * (v->max_speed - max_speed) * (4 + tf->m_tiles_skipped) / v->max_speed;
+ int max_veh_speed = v->GetDisplayMaxSpeed();
+ if (max_speed < max_veh_speed) {
+ extra_cost += YAPF_TILE_LENGTH * (max_veh_speed - max_speed) * (4 + tf->m_tiles_skipped) / max_veh_speed;
}
- if (min_speed > v->max_speed) {
- extra_cost += YAPF_TILE_LENGTH * (min_speed - v->max_speed);
+ if (min_speed > max_veh_speed) {
+ extra_cost += YAPF_TILE_LENGTH * (min_speed - max_veh_speed);
}
}