Codechange: Reorganise hotkey initialisation. (#10951)
Hotkeys are now initialized inline, and use std::vector instead of separate static C-arrays and std::string instead of char *. The list end marker is no longer required.
This commit is contained in:
@@ -338,27 +338,23 @@ struct SignListWindow : Window, SignList {
|
||||
}
|
||||
}
|
||||
|
||||
static HotkeyList hotkeys;
|
||||
};
|
||||
/**
|
||||
* Handler for global hotkeys of the SignListWindow.
|
||||
* @param hotkey Hotkey
|
||||
* @return ES_HANDLED if hotkey was accepted.
|
||||
*/
|
||||
static EventState SignListGlobalHotkeys(int hotkey)
|
||||
{
|
||||
if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
|
||||
Window *w = ShowSignList();
|
||||
if (w == nullptr) return ES_NOT_HANDLED;
|
||||
return w->OnHotkey(hotkey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for global hotkeys of the SignListWindow.
|
||||
* @param hotkey Hotkey
|
||||
* @return ES_HANDLED if hotkey was accepted.
|
||||
*/
|
||||
static EventState SignListGlobalHotkeys(int hotkey)
|
||||
{
|
||||
if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
|
||||
Window *w = ShowSignList();
|
||||
if (w == nullptr) return ES_NOT_HANDLED;
|
||||
return w->OnHotkey(hotkey);
|
||||
}
|
||||
|
||||
static Hotkey signlist_hotkeys[] = {
|
||||
Hotkey('F', "focus_filter_box", SLHK_FOCUS_FILTER_BOX),
|
||||
HOTKEY_LIST_END
|
||||
static inline HotkeyList hotkeys{"signlist", {
|
||||
Hotkey('F', "focus_filter_box", SLHK_FOCUS_FILTER_BOX),
|
||||
}, SignListGlobalHotkeys};
|
||||
};
|
||||
HotkeyList SignListWindow::hotkeys("signlist", signlist_hotkeys, SignListGlobalHotkeys);
|
||||
|
||||
static const NWidgetPart _nested_sign_list_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
|
Reference in New Issue
Block a user