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/viewport.cpp | |
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/viewport.cpp')
-rw-r--r-- | src/viewport.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp index 8347c3e8b..52488e140 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -2478,7 +2478,7 @@ static void CalcRaildirsDrawstyle(TileHighlightData *thd, int x, int y, int meth * 2 tiles have a length of 1. To bias towards the ceiling we add * one before division. It feels more natural to count 3 lengths as 2 */ if ((b & HT_DIR_MASK) != HT_DIR_X && (b & HT_DIR_MASK) != HT_DIR_Y) { - distance = (distance + 1) / 2; + distance = CeilDiv(distance, 2); } params[index++] = distance; |