summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-08-06 12:12:20 +0000
committeralberth <alberth@openttd.org>2010-08-06 12:12:20 +0000
commit3ca0ed3e82f6a943f1c4c76418b85e485bf5041a (patch)
tree205ce4d09e7105378eab717459b2ea88cd7813e2 /src
parent01833039bdcbc9f8e79de7e69f2942b3c1cca7d1 (diff)
downloadopenttd-3ca0ed3e82f6a943f1c4c76418b85e485bf5041a.tar.xz
(svn r20385) -Codechange: Move updating of buttons in the fund-industry window to a method.
Diffstat (limited to 'src')
-rw-r--r--src/industry_gui.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 61ad01213..a881237fc 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -256,6 +256,12 @@ class BuildIndustryWindow : public Window {
this->vscroll.SetCount(this->count);
}
+ /** Update status of the fund and display-chain widgets. */
+ void SetButtons()
+ {
+ this->SetWidgetsDisabledState(!this->enabled[this->selected_index], DPIW_DISPLAY_WIDGET, DPIW_FUND_WIDGET, WIDGET_LIST_END);
+ }
+
public:
BuildIndustryWindow() : Window()
{
@@ -479,7 +485,7 @@ public:
ResetObjectToPlace();
}
- this->SetWidgetsDisabledState(!this->enabled[this->selected_index], DPIW_DISPLAY_WIDGET, DPIW_FUND_WIDGET, WIDGET_LIST_END);
+ this->SetButtons();
if (this->enabled[this->selected_index] && click_count > 1) this->OnClick(pt, DPIW_FUND_WIDGET, 1);
}
break;
@@ -569,7 +575,7 @@ public:
/* Only if result does match the previous state would it require a redraw. */
if (call_back_result != this->enabled[this->selected_index]) {
this->enabled[this->selected_index] = call_back_result;
- this->SetWidgetsDisabledState(!this->enabled[this->selected_index], DPIW_DISPLAY_WIDGET, DPIW_FUND_WIDGET, WIDGET_LIST_END);
+ this->SetButtons();
this->SetDirty();
}
}
@@ -592,7 +598,7 @@ public:
const IndustrySpec *indsp = (this->selected_type == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(this->selected_type);
if (indsp == NULL) this->enabled[this->selected_index] = _settings_game.difficulty.number_industries != 0;
- this->SetWidgetsDisabledState(!this->enabled[this->selected_index], DPIW_DISPLAY_WIDGET, DPIW_FUND_WIDGET, WIDGET_LIST_END);
+ this->SetButtons();
}
};