mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-03 21:06:58 +00:00
(svn r19749) -Fix: [NewGRF] possible divide-by-zero if a newgrf checked industry var 42 while the production level was 0
This commit is contained in:
parent
eea1a772f2
commit
cb61f5ac10
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user