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/autoreplace_cmd.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/autoreplace_cmd.cpp')
-rw-r--r-- | src/autoreplace_cmd.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp index aeee94ff2..fe962cd73 100644 --- a/src/autoreplace_cmd.cpp +++ b/src/autoreplace_cmd.cpp @@ -412,7 +412,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon if (old_head->type == VEH_TRAIN) { /* Store the length of the old vehicle chain, rounded up to whole tiles */ - uint16 old_total_length = (Train::From(old_head)->tcache.cached_total_length + TILE_SIZE - 1) / TILE_SIZE * TILE_SIZE; + uint16 old_total_length = CeilDiv(Train::From(old_head)->tcache.cached_total_length, TILE_SIZE) * TILE_SIZE; int num_units = 0; ///< Number of units in the chain for (Train *w = Train::From(old_head); w != NULL; w = w->GetNextUnit()) num_units++; |