changeset 15120:f2b9f984aca7 draft

(svn r19749) -Fix: [NewGRF] possible divide-by-zero if a newgrf checked industry var 42 while the production level was 0
author yexo <yexo@openttd.org>
date Sat, 01 May 2010 18:58:50 +0000
parents 1402966ce103
children 1885be2a01b9
files src/newgrf_industries.cpp
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -204,6 +204,7 @@
 			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);