summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-10-25 02:26:02 +0000
committerbelugas <belugas@openttd.org>2007-10-25 02:26:02 +0000
commit2739ab082e985c43a6fc3a2840df52714ca14277 (patch)
tree07625cc8829d568a2c86315b9e4cc37736df037e /src
parent2c1bfe10ac74925c6b447df417ca39c2d722e2f5 (diff)
downloadopenttd-2739ab082e985c43a6fc3a2840df52714ca14277.tar.xz
(svn r11340) -Fix[FS#1362]: Newindustries can provide no production at start. So the Modifying Production cheat was a bit puzzled on how to deal with it. This will help a bit.
Diffstat (limited to 'src')
-rw-r--r--src/industry_gui.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 341ff1e2a..ae317dff6 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -379,12 +379,12 @@ static void UpdateIndustryProduction(Industry *i);
static inline bool isProductionMinimum(const Industry *i, int pt)
{
- return i->production_rate[pt] == 1;
+ return i->production_rate[pt] == 0;
}
static inline bool isProductionMaximum(const Industry *i, int pt)
{
- return i->production_rate[pt] == 255;
+ return i->production_rate[pt] >= 255;
}
static inline bool IsProductionAlterable(const Industry *i)
@@ -531,10 +531,12 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
/* Clicked buttons, decrease or increase production */
if (x < 15) {
if (isProductionMinimum(i, line)) return;
- i->production_rate[line] = max(i->production_rate[line] / 2, 1);
+ i->production_rate[line] = max(i->production_rate[line] / 2, 0);
} else {
+ /* a zero production industry is unlikely to give anything but zero, so push it a little bit */
+ int new_prod = i->production_rate[line] == 0 ? 1 : i->production_rate[line] * 2;
if (isProductionMaximum(i, line)) return;
- i->production_rate[line] = minu(i->production_rate[line] * 2, 255);
+ i->production_rate[line] = minu(new_prod, 255);
}
UpdateIndustryProduction(i);