diff options
author | frosch <frosch@openttd.org> | 2012-11-13 21:46:14 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2012-11-13 21:46:14 +0000 |
commit | 8cd77b6f6eb0e82ebcb4c0197786eeea08dd0263 (patch) | |
tree | 62aa51ffd4ffb75b3c8f3a19fa095830fbfdfb0d | |
parent | 4aa17c5109d66787db20827093996cc4384ab777 (diff) | |
download | openttd-8cd77b6f6eb0e82ebcb4c0197786eeea08dd0263.tar.xz |
(svn r24723) -Fix: AI debug GUI crashed when using disabled buttons via hotkeys.
-rw-r--r-- | src/ai/ai_gui.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 0c1a342a6..785d821a1 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -1268,12 +1268,12 @@ struct AIDebugWindow : public QueryStringBaseWindow { virtual void OnClick(Point pt, int widget, int click_count) { + /* Also called for hotkeys, so check for disabledness */ + if (this->IsWidgetDisabled(widget)) return; + /* Check which button is clicked */ if (IsInsideMM(widget, WID_AID_COMPANY_BUTTON_START, WID_AID_COMPANY_BUTTON_END + 1)) { - /* Is it no on disable? */ - if (!this->IsWidgetDisabled(widget)) { - ChangeToAI((CompanyID)(widget - WID_AID_COMPANY_BUTTON_START)); - } + ChangeToAI((CompanyID)(widget - WID_AID_COMPANY_BUTTON_START)); } switch (widget) { |