summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-05-01 18:58:50 +0000
committeryexo <yexo@openttd.org>2010-05-01 18:58:50 +0000
commitcb61f5ac10fd69ab4b4b7da32c1bf719f58f8aae (patch)
treed6bac3fe65920291f9c6765a2cc063b2288ba39c /src
parenteea1a772f26e76a9939f7a3472cf31dd43c349a6 (diff)
downloadopenttd-cb61f5ac10fd69ab4b4b7da32c1bf719f58f8aae.tar.xz
(svn r19749) -Fix: [NewGRF] possible divide-by-zero if a newgrf checked industry var 42 while the production level was 0
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_industries.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index d9aa81477..e9cd0e477 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -204,6 +204,7 @@ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte par
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);