Changeset - r15110:4b0fbedb7d1d
[Not reviewed]
master
0 1 0
yexo - 14 years ago 2010-05-01 18:58:50
yexo@openttd.org
(svn r19749) -Fix: [NewGRF] possible divide-by-zero if a newgrf checked industry var 42 while the production level was 0
1 file changed with 1 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/newgrf_industries.cpp
Show inline comments
 
@@ -204,6 +204,7 @@ uint32 IndustryGetVariable(const Resolve
 
			uint16 callback = indspec->callback_mask;
 
			if (HasBit(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(callback, CBM_IND_PRODUCTION_256_TICKS)) {
 
				if ((indspec->behaviour & INDUSTRYBEH_PROD_MULTI_HNDLING) != 0) {
 
					if (industry->prod_level == 0) return 0;
 
					return min(industry->incoming_cargo_waiting[variable - 0x40] / industry->prod_level, (uint16)0xFFFF);
 
				} else {
 
					return min(industry->incoming_cargo_waiting[variable - 0x40], (uint16)0xFFFF);
0 comments (0 inline, 0 general)