summaryrefslogtreecommitdiff
path: root/src/yapf/yapf_costrail.hpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-03-30 20:19:25 +0000
committerfrosch <frosch@openttd.org>2009-03-30 20:19:25 +0000
commit3bbf0fc87b34ccab4f3bb91e1690981aecd80c7d (patch)
tree368048d7701d14cb7660c33bb350f877a038ba65 /src/yapf/yapf_costrail.hpp
parent861c29364c23e8d5ac0a1b78f9a90b1cd1f1af69 (diff)
downloadopenttd-3bbf0fc87b34ccab4f3bb91e1690981aecd80c7d.tar.xz
(svn r15900) -Fix (r5076): Adding settings is not enough, you also have to use them.
Diffstat (limited to 'src/yapf/yapf_costrail.hpp')
-rw-r--r--src/yapf/yapf_costrail.hpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/yapf/yapf_costrail.hpp b/src/yapf/yapf_costrail.hpp
index f32b8388b..81ef6a82a 100644
--- a/src/yapf/yapf_costrail.hpp
+++ b/src/yapf/yapf_costrail.hpp
@@ -244,13 +244,13 @@ public:
assert(v != NULL);
assert(v->type == VEH_TRAIN);
assert(v->u.rail.cached_total_length != 0);
- int needed_platform_length = (v->u.rail.cached_total_length + TILE_SIZE - 1) / TILE_SIZE;
- if (platform_length > needed_platform_length) {
+ int missing_platform_length = (v->u.rail.cached_total_length + TILE_SIZE - 1) / TILE_SIZE - platform_length;
+ if (missing_platform_length < 0) {
/* apply penalty for longer platform than needed */
- cost += Yapf().PfGetSettings().rail_longer_platform_penalty;
- } else if (needed_platform_length > platform_length) {
+ cost += Yapf().PfGetSettings().rail_longer_platform_penalty + Yapf().PfGetSettings().rail_longer_platform_per_tile_penalty * -missing_platform_length;
+ } else if (missing_platform_length > 0) {
/* apply penalty for shorter platform than needed */
- cost += Yapf().PfGetSettings().rail_shorter_platform_penalty;
+ cost += Yapf().PfGetSettings().rail_shorter_platform_penalty + Yapf().PfGetSettings().rail_shorter_platform_per_tile_penalty * missing_platform_length;
}
return cost;
}