diff options
author | frosch <frosch@openttd.org> | 2010-04-18 14:56:05 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-04-18 14:56:05 +0000 |
commit | 2e90f7f8b975d380c3d544995ef6db9d6c8a86d8 (patch) | |
tree | 90fb0852bd31229b016ca998a8e6c0ce44d699dd /src/pathfinder/yapf | |
parent | 2330851d1dc0650335bc73ec4cfd010f08c55742 (diff) | |
download | openttd-2e90f7f8b975d380c3d544995ef6db9d6c8a86d8.tar.xz |
(svn r19670) -Codechange: Add CeilDiv() and RoundDiv() to simplify integer divisions with rounding.
Diffstat (limited to 'src/pathfinder/yapf')
-rw-r--r-- | src/pathfinder/yapf/yapf_costrail.hpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp index 6c4603c68..3badace9a 100644 --- a/src/pathfinder/yapf/yapf_costrail.hpp +++ b/src/pathfinder/yapf/yapf_costrail.hpp @@ -259,7 +259,7 @@ public: assert(v != NULL); assert(v->type == VEH_TRAIN); assert(v->tcache.cached_total_length != 0); - int missing_platform_length = (v->tcache.cached_total_length + TILE_SIZE - 1) / TILE_SIZE - platform_length; + int missing_platform_length = CeilDiv(v->tcache.cached_total_length, TILE_SIZE) - platform_length; if (missing_platform_length < 0) { /* apply penalty for longer platform than needed */ cost += Yapf().PfGetSettings().rail_longer_platform_penalty + Yapf().PfGetSettings().rail_longer_platform_per_tile_penalty * -missing_platform_length; |