Mercurial > hg > openttd
changeset 7790:5ead3ee7f7b7 draft
(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.
author | belugas <belugas@openttd.org> |
---|---|
date | Thu, 25 Oct 2007 02:26:02 +0000 |
parents | bf6bc46be9da |
children | 654d0780a613 |
files | src/industry_gui.cpp |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -379,12 +379,12 @@ 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 @@ /* 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);