summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-06-15 15:30:44 +0000
committerfrosch <frosch@openttd.org>2013-06-15 15:30:44 +0000
commit5cb174c6b86c58b2ff6ec0d245e546328fae6480 (patch)
tree3daf547fa10b3e701086c7e0546cded7e6261bbb /src/ai
parent62913838237c474419c68124ea7aebd74e72c628 (diff)
downloadopenttd-5cb174c6b86c58b2ff6ec0d245e546328fae6480.tar.xz
(svn r25412) -Codechange: Make use of Window::OnHotkey
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/ai_gui.cpp22
1 files changed, 3 insertions, 19 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index acaaff710..99f806038 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -1306,23 +1306,6 @@ struct AIDebugWindow : public Window {
}
}
- virtual EventState OnKeyPress(uint16 key, uint16 keycode)
- {
- EventState state = ES_NOT_HANDLED;
- int num = this->hotkeys.CheckMatch(keycode);
- if (num != -1) {
- if (this->show_break_box && num == WID_AID_BREAK_STR_EDIT_BOX) {
- this->SetFocusedWidget(WID_AID_BREAK_STR_EDIT_BOX);
- SetFocusedWindow(this);
- state = ES_HANDLED;
- } else if (this->show_break_box || num < WID_AID_BREAK_STRING_WIDGETS) {
- this->OnClick(Point(), num, 1);
- state = ES_HANDLED;
- }
- }
- return state;
- }
-
virtual void OnEditboxChanged(int wid)
{
if (wid == WID_AID_BREAK_STR_EDIT_BOX) {
@@ -1494,7 +1477,8 @@ static WindowDesc _ai_debug_desc(
WDP_AUTO, "script_debug", 600, 450,
WC_AI_DEBUG, WC_NONE,
0,
- _nested_ai_debug_widgets, lengthof(_nested_ai_debug_widgets)
+ _nested_ai_debug_widgets, lengthof(_nested_ai_debug_widgets),
+ &AIDebugWindow::hotkeys
);
/**
@@ -1524,7 +1508,7 @@ EventState AIDebugGlobalHotkeys(uint16 key, uint16 keycode)
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowAIDebugWindow(INVALID_COMPANY);
if (w == NULL) return ES_NOT_HANDLED;
- return w->OnKeyPress(key, keycode);
+ return w->OnHotkey(num);
}
/**