From 1ec328f725ee023fcb6d2c94b7612719bd932090 Mon Sep 17 00:00:00 2001 From: yexo Date: Wed, 21 Jul 2010 14:28:06 +0000 Subject: (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. --- src/order_gui.cpp | 35 ++++++++++++++++++++++++++++++----- src/toolbar_gui.cpp | 13 +++++++++++++ 2 files changed, 43 insertions(+), 5 deletions(-) (limited to 'src') 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 @@ -551,6 +551,14 @@ private: DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_LOAD | (load_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER)); } + /** + * Handle the 'no loading' hotkey + */ + void OrderHotkey_NoLoad(int i) + { + this->OrderClick_FullLoad(OLFB_NO_LOAD); + } + /** * Handle the click on the service. */ @@ -611,6 +619,22 @@ private: DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_UNLOAD | (unload_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER)); } + /** + * 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::order_hotkeys[]= { Hotkey('H', "nonstop", 0, &OrdersWindow::OrderClick_Nonstop), Hotkey('J', "fullload", 0, &OrdersWindow::OrderClick_FullLoad), Hotkey('K', "unload", 0, &OrdersWindow::OrderClick_Unload), + Hotkey((uint16)0, "nearest_depot", 0, &OrdersWindow::OrderClick_NearestDepot), + Hotkey((uint16)0, "always_service", 0, &OrdersWindow::OrderClick_Service), + Hotkey((uint16)0, "force_unload", 0, &OrdersWindow::OrderClick_Unload), + Hotkey((uint16)0, "transfer", 0, &OrdersWindow::OrderHotkey_Transfer), + Hotkey((uint16)0, "no_unload", 0, &OrdersWindow::OrderHotkey_NoUnload), + Hotkey((uint16)0, "no_load", 0, &OrdersWindow::OrderHotkey_NoLoad), HOTKEY_LIST_END(OrdersWindow) }; Hotkey *_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::maintoolbar_hotkeys[] = { Hotkey((uint16)0, "fastforward", MTHK_FASTFORWARD), Hotkey(WKC_F2, "settings", MTHK_SETTINGS), Hotkey(WKC_F3, "saveload", MTHK_SAVEGAME), + Hotkey((uint16)0, "load_game", MTHK_LOADGAME), Hotkey(_maintoolbar_smallmap_keys, "smallmap", MTHK_SMALLMAP), Hotkey(WKC_F5, "town_list", MTHK_TOWNDIRECTORY), Hotkey(WKC_F6, "subsidies", MTHK_SUBSIDIES), @@ -1406,6 +1415,10 @@ Hotkey MainToolbarWindow::maintoolbar_hotkeys[] = { Hotkey(WKC_CTRL | WKC_ALT | 'C', "cheats", MTHK_CHEATS), Hotkey('L', "terraform", MTHK_TERRAFORM), Hotkey('V', "extra_viewport", MTHK_EXTRA_VIEWPORT), +#ifdef ENABLE_NETWORK + Hotkey((uint16)0, "client_list", MTHK_CLIENT_LIST), +#endif + Hotkey((uint16)0, "sign_list", MTHK_SIGN_LIST), HOTKEY_LIST_END(MainToolbarWindow) }; Hotkey *_maintoolbar_hotkeys = MainToolbarWindow::maintoolbar_hotkeys; -- cgit v1.2.3-70-g09d2