(svn r19670) -Codechange: Add CeilDiv() and RoundDiv() to simplify integer divisions with rounding.

This commit is contained in:
frosch
2010-04-18 14:56:05 +00:00
parent 2330851d1d
commit 2e90f7f8b9
15 changed files with 50 additions and 30 deletions

View File

@@ -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;