Introduce surrender hotkey
This commit is contained in:
parent
024b2e7e9b
commit
4f1a7a9faa
6 changed files with 20 additions and 3 deletions
|
@ -367,7 +367,12 @@
|
|||
ctrl=yes
|
||||
[/hotkey]
|
||||
#endif
|
||||
|
||||
[hotkey]
|
||||
command="surrender"
|
||||
key="s"
|
||||
shift=yes
|
||||
ctrl=yes
|
||||
[/hotkey]
|
||||
[hotkey]
|
||||
command="editor-partial-undo"
|
||||
key="z"
|
||||
|
|
|
@ -350,6 +350,9 @@ bool command_executor::execute_command(const hotkey_command& cmd, int /*index*/
|
|||
break;
|
||||
case HOTKEY_QUIT_GAME:
|
||||
quit_confirmation::quit_to_title();
|
||||
break;
|
||||
case HOTKEY_SURRENDER:
|
||||
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
@ -357,6 +360,13 @@ bool command_executor::execute_command(const hotkey_command& cmd, int /*index*/
|
|||
return true;
|
||||
}
|
||||
|
||||
void command_executor::surrender_game() {
|
||||
if(gui2::show_message(_("Surrender"), _("Do you really want to surrender the game?"), gui2::dialogs::message::yes_no_buttons) != gui2::window::CANCEL) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void command_executor::show_menu(const std::vector<config>& items_arg, int xloc, int yloc, bool /*context_menu*/, display& gui)
|
||||
{
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
std::string get_menu_image(display& disp, const std::string& command, int index=-1) const;
|
||||
// Returns a vector of images for a given menu.
|
||||
void get_menu_images(display &, std::vector<config>& items);
|
||||
|
||||
void surrender_game();
|
||||
virtual void show_menu(const std::vector<config>& items_arg, int xloc, int yloc, bool context_menu, display& gui);
|
||||
void execute_action(const std::vector<std::string>& items_arg, int xloc, int yloc, bool context_menu, display& gui);
|
||||
|
||||
|
|
|
@ -102,6 +102,7 @@ std::array<hotkey_command_temp, HOTKEY_NULL - 1> hotkey_list_ {{
|
|||
{ HOTKEY_STATISTICS, "statistics", N_("Statistics"), false, scope_game, HKCAT_GENERAL, "" },
|
||||
{ HOTKEY_STOP_NETWORK, "stopnetwork", N_("Pause Network Game"), false, scope_game, HKCAT_GENERAL, "" },
|
||||
{ HOTKEY_START_NETWORK, "startnetwork", N_("Continue Network Game"), false, scope_game, HKCAT_GENERAL, "" },
|
||||
{ HOTKEY_SURRENDER, "surrender", N_("Surrender Game"), false, scope_game, HKCAT_SCENARIO, "" },
|
||||
{ HOTKEY_QUIT_GAME, "quit", N_("Quit to Titlescreen"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
|
||||
{ HOTKEY_LABEL_TEAM_TERRAIN, "labelteamterrain", N_("Set Team Label"), false, scope_game, HKCAT_MAP, "" },
|
||||
{ HOTKEY_LABEL_TERRAIN, "labelterrain", N_("Set Label"), false, scope_game, HKCAT_MAP, "" },
|
||||
|
|
|
@ -48,7 +48,7 @@ enum HOTKEY_COMMAND {
|
|||
HOTKEY_RECRUIT, HOTKEY_REPEAT_RECRUIT, HOTKEY_RECALL, HOTKEY_ENDTURN,
|
||||
HOTKEY_TOGGLE_ELLIPSES, HOTKEY_TOGGLE_GRID, HOTKEY_STATUS_TABLE, HOTKEY_MUTE, HOTKEY_MOUSE_SCROLL,
|
||||
HOTKEY_SPEAK, HOTKEY_CREATE_UNIT, HOTKEY_CHANGE_SIDE, HOTKEY_KILL_UNIT, HOTKEY_PREFERENCES,
|
||||
HOTKEY_OBJECTIVES, HOTKEY_UNIT_LIST, HOTKEY_STATISTICS, HOTKEY_STOP_NETWORK, HOTKEY_START_NETWORK, HOTKEY_QUIT_GAME, HOTKEY_QUIT_TO_DESKTOP,
|
||||
HOTKEY_OBJECTIVES, HOTKEY_UNIT_LIST, HOTKEY_STATISTICS, HOTKEY_STOP_NETWORK, HOTKEY_START_NETWORK, HOTKEY_SURRENDER, HOTKEY_QUIT_GAME, HOTKEY_QUIT_TO_DESKTOP,
|
||||
HOTKEY_LABEL_TEAM_TERRAIN, HOTKEY_LABEL_TERRAIN, HOTKEY_CLEAR_LABELS,HOTKEY_SHOW_ENEMY_MOVES, HOTKEY_BEST_ENEMY_MOVES,
|
||||
HOTKEY_DELAY_SHROUD, HOTKEY_UPDATE_SHROUD, HOTKEY_CONTINUE_MOVE,
|
||||
HOTKEY_SEARCH, HOTKEY_SPEAK_ALLY, HOTKEY_SPEAK_ALL, HOTKEY_HELP,
|
||||
|
|
|
@ -296,6 +296,7 @@ bool play_controller::hotkey_handler::can_execute_command(const hotkey::hotkey_c
|
|||
case hotkey::HOTKEY_OBJECTIVES:
|
||||
case hotkey::HOTKEY_UNIT_LIST:
|
||||
case hotkey::HOTKEY_STATISTICS:
|
||||
case hotkey::HOTKEY_SURRENDER:
|
||||
case hotkey::HOTKEY_QUIT_GAME:
|
||||
case hotkey::HOTKEY_QUIT_TO_DESKTOP:
|
||||
case hotkey::HOTKEY_SEARCH:
|
||||
|
|
Loading…
Add table
Reference in a new issue