summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-03-29 11:41:42 +0000
committerfrosch <frosch@openttd.org>2009-03-29 11:41:42 +0000
commitf436a58b5e83742f2809377e4852a8c353d766ee (patch)
tree7cf9d1b82e34bfa72a1ac2354d40140e9e2062c2 /src
parent9eff54febeeef8c50adaea0514eae1072ef515f1 (diff)
downloadopenttd-f436a58b5e83742f2809377e4852a8c353d766ee.tar.xz
(svn r15888) -Fix (r15103)[FS#2772]: Round the production rate up, so e.g. oilrigs always produce some passengers on lowest production level.
Diffstat (limited to 'src')
-rw-r--r--src/industry_cmd.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index d28b490c3..88cdf7a09 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -2211,8 +2211,9 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
/* Recalculate production_rate
* For non-smooth economy these should always be synchronized with prod_level */
if (recalculate_multipliers) {
- i->production_rate[0] = min(indspec->production_rate[0] * i->prod_level / PRODLEVEL_DEFAULT, 0xFF);
- i->production_rate[1] = min(indspec->production_rate[1] * i->prod_level / PRODLEVEL_DEFAULT, 0xFF);
+ /* 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);
}
/* Close if needed and allowed */