summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-06-22 23:53:16 +0000
committertruelight <truelight@openttd.org>2007-06-22 23:53:16 +0000
commit27a6e2197582756f9502edd43e50d84b29bbec1d (patch)
treeafec8aa202ea6980fd46c961c6d972ac13b57410 /src
parent2d42f4544d4ca0d634b5eb578c64f243bfd5d713 (diff)
downloadopenttd-27a6e2197582756f9502edd43e50d84b29bbec1d.tar.xz
(svn r10290) -Fix: with smooth_economy, when industry production hit 32, it stayed there for ever. Give it some chance to get out of that uber-lowness (although it is a very slim chance, at least it has one)
Diffstat (limited to 'src')
-rw-r--r--src/industry_cmd.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index d7f7d0566..4ae71a1a3 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1643,7 +1643,11 @@ static void ExtChangeIndustryProduction(Industry *i)
if (CHANCE16I(20, 1024, r))
new_prod -= ((RandomRange(50) + 10) * old_prod) >> 8;
if (CHANCE16I(20 + (i->last_month_pct_transported[j] * 20 >> 8), 1024, r >> 16))
- new_prod += ((RandomRange(50) + 10) * old_prod) >> 8;
+ /* old_prod gets stuck at '4' because 60 * 4 / 256 < 1, so in that case
+ * increase the odds a bit for increasing, so at least it can escape
+ * the production of '4' at some time in the future (instead of being
+ * stuck there for ever). */
+ new_prod += ((RandomRange(old_prod == 4 ? 55 : 50) + 10) * old_prod) >> 8;
new_prod = clamp(new_prod, 0, 255);
if (new_prod == old_prod) {