From 1b8b1f3f6cbd65b73399b1d39aacb7fb674a091c Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 15 Jun 2013 15:28:09 +0000 Subject: (svn r25410) -Codechange: Put all hotkeys of a window into a static HotkeyList member. --- src/ai/ai_gui.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ai/ai_gui.cpp') diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index d49657bd8..acaaff710 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -1309,7 +1309,7 @@ struct AIDebugWindow : public Window { virtual EventState OnKeyPress(uint16 key, uint16 keycode) { EventState state = ES_NOT_HANDLED; - int num = CheckHotkeyMatch(aidebug_hotkeys, keycode); + 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); @@ -1400,7 +1400,7 @@ struct AIDebugWindow : public Window { this->vscroll->SetCapacityFromWidget(this, WID_AID_LOG_PANEL); } - static Hotkey aidebug_hotkeys[]; + static HotkeyList hotkeys; }; const int AIDebugWindow::top_offset = WD_FRAMERECT_TOP + 2; @@ -1417,7 +1417,7 @@ NWidgetBase *MakeCompanyButtonRowsAIDebug(int *biggest_index) return MakeCompanyButtonRows(biggest_index, WID_AID_COMPANY_BUTTON_START, WID_AID_COMPANY_BUTTON_END, 8, STR_AI_DEBUG_SELECT_AI_TOOLTIP); } -Hotkey AIDebugWindow::aidebug_hotkeys[] = { +static Hotkey aidebug_hotkeys[] = { Hotkey('1', "company_1", WID_AID_COMPANY_BUTTON_START), Hotkey('2', "company_2", WID_AID_COMPANY_BUTTON_START + 1), Hotkey('3', "company_3", WID_AID_COMPANY_BUTTON_START + 2), @@ -1442,7 +1442,7 @@ Hotkey AIDebugWindow::aidebug_hotkeys[] = { Hotkey(WKC_RETURN, "continue", WID_AID_CONTINUE_BTN), HOTKEY_LIST_END }; -Hotkey *_aidebug_hotkeys = AIDebugWindow::aidebug_hotkeys; +HotkeyList AIDebugWindow::hotkeys("aidebug", aidebug_hotkeys); /** Widgets for the AI debug window. */ static const NWidgetPart _nested_ai_debug_widgets[] = { @@ -1520,7 +1520,7 @@ Window *ShowAIDebugWindow(CompanyID show_company) */ EventState AIDebugGlobalHotkeys(uint16 key, uint16 keycode) { - int num = CheckHotkeyMatch(_aidebug_hotkeys, keycode, true); + int num = AIDebugWindow::hotkeys.CheckMatch(keycode, true); if (num == -1) return ES_NOT_HANDLED; Window *w = ShowAIDebugWindow(INVALID_COMPANY); if (w == NULL) return ES_NOT_HANDLED; -- cgit v1.2.3-54-g00ecf