diff options
author | yexo <yexo@openttd.org> | 2010-07-21 14:28:06 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-07-21 14:28:06 +0000 |
commit | 1ec328f725ee023fcb6d2c94b7612719bd932090 (patch) | |
tree | c694b10a8bafa6fe657e0c8ecfce0b2538954d15 | |
parent | 2828f36aa4c1ee1657b8ae28398d2aa1496493c8 (diff) | |
download | openttd-1ec328f725ee023fcb6d2c94b7612719bd932090.tar.xz |
(svn r20201) -Feature [FS#3926]: add several new hotkeys to the global hotkey list and to the order windows. None of them has a default keybinding.
-rw-r--r-- | src/order_gui.cpp | 35 | ||||
-rw-r--r-- | src/toolbar_gui.cpp | 13 |
2 files changed, 43 insertions, 5 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 4f23a7140..a815cdca4 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -552,6 +552,14 @@ private: } /** + * Handle the 'no loading' hotkey + */ + void OrderHotkey_NoLoad(int i) + { + this->OrderClick_FullLoad(OLFB_NO_LOAD); + } + + /** * Handle the click on the service. */ void OrderClick_Service(int i) @@ -612,6 +620,22 @@ private: } /** + * Handle the transfer hotkey + */ + void OrderHotkey_Transfer(int i) + { + this->OrderClick_Unload(OUFB_TRANSFER); + } + + /** + * Handle the 'no unload' hotkey + */ + void OrderHotkey_NoUnload(int i) + { + this->OrderClick_Unload(OUFB_NO_UNLOAD); + } + + /** * Handle the click on the nonstop button. * @param non_stop what non-stop type to use; -1 to use the 'next' one. */ @@ -677,11 +701,6 @@ private: ShowVehicleRefitWindow(this->vehicle, this->OrderGetSel(), this); } } - typedef void (OrdersWindow::*Handler)(int); - struct KeyToEvent { - uint16 keycode; - Handler proc; - }; public: OrdersWindow(const WindowDesc *desc, const Vehicle *v) : Window() @@ -1341,6 +1360,12 @@ Hotkey<OrdersWindow> OrdersWindow::order_hotkeys[]= { Hotkey<OrdersWindow>('H', "nonstop", 0, &OrdersWindow::OrderClick_Nonstop), Hotkey<OrdersWindow>('J', "fullload", 0, &OrdersWindow::OrderClick_FullLoad), Hotkey<OrdersWindow>('K', "unload", 0, &OrdersWindow::OrderClick_Unload), + Hotkey<OrdersWindow>((uint16)0, "nearest_depot", 0, &OrdersWindow::OrderClick_NearestDepot), + Hotkey<OrdersWindow>((uint16)0, "always_service", 0, &OrdersWindow::OrderClick_Service), + Hotkey<OrdersWindow>((uint16)0, "force_unload", 0, &OrdersWindow::OrderClick_Unload), + Hotkey<OrdersWindow>((uint16)0, "transfer", 0, &OrdersWindow::OrderHotkey_Transfer), + Hotkey<OrdersWindow>((uint16)0, "no_unload", 0, &OrdersWindow::OrderHotkey_NoUnload), + Hotkey<OrdersWindow>((uint16)0, "no_load", 0, &OrdersWindow::OrderHotkey_NoLoad), HOTKEY_LIST_END(OrdersWindow) }; Hotkey<OrdersWindow> *_order_hotkeys = OrdersWindow::order_hotkeys; diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index fe1bdccee..5e8f27b63 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -1229,6 +1229,7 @@ enum MainToolbarHotkeys { MTHK_FASTFORWARD, MTHK_SETTINGS, MTHK_SAVEGAME, + MTHK_LOADGAME, MTHK_SMALLMAP, MTHK_TOWNDIRECTORY, MTHK_SUBSIDIES, @@ -1255,6 +1256,8 @@ enum MainToolbarHotkeys { MTHK_CHEATS, MTHK_TERRAFORM, MTHK_EXTRA_VIEWPORT, + MTHK_CLIENT_LIST, + MTHK_SIGN_LIST, }; struct MainToolbarWindow : Window { @@ -1301,6 +1304,7 @@ struct MainToolbarWindow : Window { case MTHK_FASTFORWARD: ToolbarFastForwardClick(this); break; case MTHK_SETTINGS: ShowGameOptions(); break; case MTHK_SAVEGAME: MenuClickSaveLoad(); break; + case MTHK_LOADGAME: ShowSaveLoadDialog(SLD_LOAD_GAME); break; case MTHK_SMALLMAP: ShowSmallMap(); break; case MTHK_TOWNDIRECTORY: ShowTownDirectory(); break; case MTHK_SUBSIDIES: ShowSubsidiesList(); break; @@ -1327,6 +1331,10 @@ struct MainToolbarWindow : Window { case MTHK_CHEATS: if (!_networking) ShowCheatWindow(); break; case MTHK_TERRAFORM: ShowTerraformToolbar(); break; case MTHK_EXTRA_VIEWPORT: ShowExtraViewPortWindow(); break; +#ifdef ENABLE_NETWORK + case MTHK_CLIENT_LIST: if (_networking) ShowClientList(); break; +#endif + case MTHK_SIGN_LIST: ShowSignList(); break; default: return ES_NOT_HANDLED; } return ES_HANDLED; @@ -1380,6 +1388,7 @@ Hotkey<MainToolbarWindow> MainToolbarWindow::maintoolbar_hotkeys[] = { Hotkey<MainToolbarWindow>((uint16)0, "fastforward", MTHK_FASTFORWARD), Hotkey<MainToolbarWindow>(WKC_F2, "settings", MTHK_SETTINGS), Hotkey<MainToolbarWindow>(WKC_F3, "saveload", MTHK_SAVEGAME), + Hotkey<MainToolbarWindow>((uint16)0, "load_game", MTHK_LOADGAME), Hotkey<MainToolbarWindow>(_maintoolbar_smallmap_keys, "smallmap", MTHK_SMALLMAP), Hotkey<MainToolbarWindow>(WKC_F5, "town_list", MTHK_TOWNDIRECTORY), Hotkey<MainToolbarWindow>(WKC_F6, "subsidies", MTHK_SUBSIDIES), @@ -1406,6 +1415,10 @@ Hotkey<MainToolbarWindow> MainToolbarWindow::maintoolbar_hotkeys[] = { Hotkey<MainToolbarWindow>(WKC_CTRL | WKC_ALT | 'C', "cheats", MTHK_CHEATS), Hotkey<MainToolbarWindow>('L', "terraform", MTHK_TERRAFORM), Hotkey<MainToolbarWindow>('V', "extra_viewport", MTHK_EXTRA_VIEWPORT), +#ifdef ENABLE_NETWORK + Hotkey<MainToolbarWindow>((uint16)0, "client_list", MTHK_CLIENT_LIST), +#endif + Hotkey<MainToolbarWindow>((uint16)0, "sign_list", MTHK_SIGN_LIST), HOTKEY_LIST_END(MainToolbarWindow) }; Hotkey<MainToolbarWindow> *_maintoolbar_hotkeys = MainToolbarWindow::maintoolbar_hotkeys; |