summaryrefslogtreecommitdiff
path: root/src/industry_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-04-18 14:56:05 +0000
committerfrosch <frosch@openttd.org>2010-04-18 14:56:05 +0000
commit2e90f7f8b975d380c3d544995ef6db9d6c8a86d8 (patch)
tree90fb0852bd31229b016ca998a8e6c0ce44d699dd /src/industry_cmd.cpp
parent2330851d1dc0650335bc73ec4cfd010f08c55742 (diff)
downloadopenttd-2e90f7f8b975d380c3d544995ef6db9d6c8a86d8.tar.xz
(svn r19670) -Codechange: Add CeilDiv() and RoundDiv() to simplify integer divisions with rounding.
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r--src/industry_cmd.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index f25ada8c3..24d279170 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -2332,8 +2332,8 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
* For non-smooth economy these should always be synchronized with prod_level */
if (recalculate_multipliers) {
/* Rates are rounded up, so e.g. oilrig always produces some passengers */
- i->production_rate[0] = min((indspec->production_rate[0] * i->prod_level + PRODLEVEL_DEFAULT - 1) / PRODLEVEL_DEFAULT, 0xFF);
- i->production_rate[1] = min((indspec->production_rate[1] * i->prod_level + PRODLEVEL_DEFAULT - 1) / PRODLEVEL_DEFAULT, 0xFF);
+ i->production_rate[0] = min(CeilDiv(indspec->production_rate[0] * i->prod_level, PRODLEVEL_DEFAULT), 0xFF);
+ i->production_rate[1] = min(CeilDiv(indspec->production_rate[1] * i->prod_level, PRODLEVEL_DEFAULT), 0xFF);
}
/* Close if needed and allowed */