Mercurial > hg > openttd
changeset 15542:1a0df55d6195 draft
(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.
author | yexo <yexo@openttd.org> |
---|---|
date | Wed, 21 Jul 2010 14:28:06 +0000 |
parents | e66be28ee89e |
children | 4aa96bbef69a |
files | src/order_gui.cpp src/toolbar_gui.cpp |
diffstat | 2 files changed, 43 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -552,6 +552,14 @@ } /** + * 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 @@ } /** + * 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 @@ 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>('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;
--- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -1229,6 +1229,7 @@ MTHK_FASTFORWARD, MTHK_SETTINGS, MTHK_SAVEGAME, + MTHK_LOADGAME, MTHK_SMALLMAP, MTHK_TOWNDIRECTORY, MTHK_SUBSIDIES, @@ -1255,6 +1256,8 @@ MTHK_CHEATS, MTHK_TERRAFORM, MTHK_EXTRA_VIEWPORT, + MTHK_CLIENT_LIST, + MTHK_SIGN_LIST, }; struct MainToolbarWindow : Window { @@ -1301,6 +1304,7 @@ 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 @@ 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>((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>(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;