changeset 11527:e1495d47b9d5 draft

(svn r15888) -Fix (r15103)[FS#2772]: Round the production rate up, so e.g. oilrigs always produce some passengers on lowest production level.
author frosch <frosch@openttd.org>
date Sun, 29 Mar 2009 11:41:42 +0000
parents aea3c6ad1ab4
children 2ee677c87220
files src/industry_cmd.cpp
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -2211,8 +2211,9 @@
 	/* 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 */