From bdb4ae940dbcf5d6d2dcedce7936012aea891a8e Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 15 Aug 2010 10:14:08 +0000 Subject: (svn r20496) -Codechange: Remove IsProductionMinimum()/Maximum(). The 0 and 255 constants are used all over the place, no need for trivial wrapper functions. --- src/industry_gui.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 12842f365..c153769f5 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -623,16 +623,6 @@ void ShowBuildIndustryWindow() static void UpdateIndustryProduction(Industry *i); -static inline bool IsProductionMinimum(const Industry *i, int pt) -{ - return i->production_rate[pt] == 0; -} - -static inline bool IsProductionMaximum(const Industry *i, int pt) -{ - return i->production_rate[pt] >= 255; -} - static inline bool IsProductionAlterable(const Industry *i) { return ((_game_mode == GM_EDITOR || _cheats.setup_prod.value) && @@ -755,7 +745,7 @@ public: /* Let's put out those buttons.. */ if (IsProductionAlterable(i)) { DrawArrowButtons(left + WD_FRAMETEXT_LEFT, y, COLOUR_YELLOW, (this->clicked_line == j + 1) ? this->clicked_button : 0, - !IsProductionMinimum(i, j), !IsProductionMaximum(i, j)); + i->production_rate[j] > 0, i->production_rate[j] < 255); } y += FONT_HEIGHT_NORMAL; } @@ -807,12 +797,12 @@ public: if (IsInsideMM(x, left, left + 20) ) { /* Clicked buttons, decrease or increase production */ if (x < left + 10) { - if (IsProductionMinimum(i, line)) return; + if (i->production_rate[line] <= 0) return; 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; + if (i->production_rate[line] >= 255) return; i->production_rate[line] = minu(new_prod, 255); } -- cgit v1.2.3-70-g09d2