@@ -29,12 +29,14 @@
#include "company_func.h"
#include "toolbar_gui.h"
#include "statusbar_gui.h"
#include "tilehighlight_func.h"
#include "hotkeys.h"
#include "saveload/saveload.h"
#include "network/network.h"
#include "network/network_func.h"
#include "network/network_gui.h"
#include "network/network_base.h"
#include "table/sprites.h"
@@ -214,12 +216,13 @@ static const WindowDesc _main_window_des
0,
_nested_main_window_widgets, lengthof(_nested_main_window_widgets)
);
enum {
GHK_QUIT,
GHK_ABANDON,
GHK_CONSOLE,
GHK_BOUNDING_BOXES,
GHK_CENTER,
GHK_CENTER_ZOOM,
GHK_RESET_OBJECT_TO_PLACE,
GHK_DELETE_WINDOWS,
@@ -280,22 +283,33 @@ struct MainWindow : Window
/* Disable all key shortcuts, except quit shortcuts when
* generating the world, otherwise they create threading
* problem during the generating, resulting in random
* assertions that are hard to trigger and debug */
if (IsGeneratingWorld()) return ES_NOT_HANDLED;
if (num == GHK_CONSOLE) {
IConsoleSwitch();
return ES_HANDLED;
}
switch (num) {
case GHK_ABANDON:
/* No point returning from the main menu to itself */
if (_game_mode == GM_MENU) return ES_HANDLED;
if (_settings_client.gui.autosave_on_exit) {
DoExitSave();
_switch_mode = SM_MENU;
} else {
AskExitToGameMenu();
if (num == GHK_BOUNDING_BOXES) {
extern bool _draw_bounding_boxes;
_draw_bounding_boxes = !_draw_bounding_boxes;
MarkWholeScreenDirty();
case GHK_CONSOLE:
case GHK_BOUNDING_BOXES:
if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
case GHK_CENTER:
@@ -434,19 +448,21 @@ struct MainWindow : Window
static Hotkey<MainWindow> global_hotkeys[];
};
const uint16 _ghk_quit_keys[] = {'Q' | WKC_CTRL, 'Q' | WKC_META, 0};
const uint16 _ghk_abandon_keys[] = {'W' | WKC_CTRL, 'W' | WKC_META, 0};
const uint16 _ghk_chat_keys[] = {WKC_RETURN, 'T', 0};
const uint16 _ghk_chat_all_keys[] = {WKC_SHIFT | WKC_RETURN, WKC_SHIFT | 'T', 0};
const uint16 _ghk_chat_company_keys[] = {WKC_CTRL | WKC_RETURN, WKC_CTRL | 'T', 0};
const uint16 _ghk_chat_server_keys[] = {WKC_CTRL | WKC_SHIFT | WKC_RETURN, WKC_CTRL | WKC_SHIFT | 'T', 0};
Hotkey<MainWindow> MainWindow::global_hotkeys[] = {
Hotkey<MainWindow>(_ghk_quit_keys, "quit", GHK_QUIT),
Hotkey<MainWindow>(_ghk_abandon_keys, "abandon", GHK_ABANDON),
Hotkey<MainWindow>(WKC_BACKQUOTE, "console", GHK_CONSOLE),
Hotkey<MainWindow>('B' | WKC_CTRL, "bounding_boxes", GHK_BOUNDING_BOXES),
Hotkey<MainWindow>('C', "center", GHK_CENTER),
Hotkey<MainWindow>('Z', "center_zoom", GHK_CENTER_ZOOM),
Hotkey<MainWindow>(WKC_ESC, "reset_object_to_place", GHK_RESET_OBJECT_TO_PLACE),
Hotkey<MainWindow>(WKC_DELETE, "delete_windows", GHK_DELETE_WINDOWS),
Status change: