diff options
author | belugas <belugas@openttd.org> | 2007-10-25 02:26:02 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2007-10-25 02:26:02 +0000 |
commit | 5da0e87d9dacb1e9399c65cc60f286d74a0aff72 (patch) | |
tree | 07625cc8829d568a2c86315b9e4cc37736df037e /src | |
parent | 3a785b000a57655871cf9b14b1602e950d17a751 (diff) | |
download | openttd-5da0e87d9dacb1e9399c65cc60f286d74a0aff72.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.cpp | 10 |
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); |