From: Markus Armbruster Date: Sun, 13 Jan 2013 16:17:44 +0000 (+0100) Subject: Fix melting of big piles of stuff by ridiculously heavy fallout X-Git-Tag: v4.3.31~67 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=5ed02791f5d1b74eb383c52347eda41ce0256472 Fix melting of big piles of stuff by ridiculously heavy fallout meltitems() computes #items * etus per update * fallout in type long. Theoretical maximum is ITEM_MAX * etus * FALLOUT_MAX = 99980001 * etus. Can overflow 32 bits for etus > 21. Has been broken since the introduction of fallout in KSU. Compute the product in double instead. --- diff --git a/src/lib/update/sect.c b/src/lib/update/sect.c index 99310647d..0bf31bf7e 100644 --- a/src/lib/update/sect.c +++ b/src/lib/update/sect.c @@ -159,7 +159,7 @@ meltitems(int etus, int fallout, int own, short *vec, int melt; for (n = I_NONE + 1; n <= I_MAX; n++) { - melt = roundavg(vec[n] * etus * (long)fallout + melt = roundavg(vec[n] * etus * (double)fallout / (1000.0 * ichr[n].i_melt_denom)); if (melt > vec[n]) melt = vec[n];