Changeset - r11522:098d379f32c8
[Not reviewed]
master
0 1 0
frosch - 15 years ago 2009-03-29 11:41:42
frosch@openttd.org
(svn r15888) -Fix (r15103)[FS#2772]: Round the production rate up, so e.g. oilrigs always produce some passengers on lowest production level.
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -2202,26 +2202,27 @@ static void ChangeIndustryProduction(Ind
 
	if (increment != 0) {
 
		if (increment < 0 && i->prod_level == PRODLEVEL_MINIMUM) {
 
			closeit = true;
 
		} else {
 
			i->prod_level = ClampU(i->prod_level + increment, PRODLEVEL_MINIMUM, PRODLEVEL_MAXIMUM);
 
			recalculate_multipliers = true;
 
		}
 
	}
 

	
 
	/* 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 */
 
	if (closeit && !CheckIndustryCloseDownProtection(i->type)) {
 
		i->prod_level = PRODLEVEL_CLOSURE;
 
		str = indspec->closure_text;
 
	}
 

	
 
	if (!suppress_message && str != STR_NULL) {
 
		NewsSubtype ns;
 
		/* Compute news category */
 
		if (closeit) {
0 comments (0 inline, 0 general)