The Battle for Wesnoth  1.13.11+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
command_executor.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2018 by David White <dave@whitevine.net>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
16 #include "hotkey/hotkey_item.hpp"
17 
19 #include "gui/dialogs/message.hpp"
23 #include "gui/widgets/window.hpp"
24 #include "filesystem.hpp"
25 #include "gettext.hpp"
26 #include "log.hpp"
27 #include "preferences/general.hpp"
28 #include "game_end_exceptions.hpp"
29 #include "display.hpp"
30 #include "quit_confirmation.hpp"
31 #include "show_dialog.hpp"
32 #include "../resources.hpp"
33 #include "../playmp_controller.hpp"
34 
35 #include "utils/functional.hpp"
36 
37 #include <cassert>
38 
39 static lg::log_domain log_config("config");
40 #define ERR_G LOG_STREAM(err, lg::general())
41 #define WRN_G LOG_STREAM(warn, lg::general())
42 #define LOG_G LOG_STREAM(info, lg::general())
43 #define DBG_G LOG_STREAM(debug, lg::general())
44 #define ERR_CF LOG_STREAM(err, log_config)
45 
46 namespace {
47 
48 bool screenshot(const std::string& filename)
49 {
50  return image::save_image(CVideo::get_singleton().getSurface(), filename);
51 }
52 
53 template<typename TFunc>
54 void make_screenshot(const std::string& name, const TFunc& func)
55 {
56  std::string filename = filesystem::get_screenshot_dir() + "/" + name + "_";
57 #ifdef HAVE_LIBPNG
58  const std::string ext = ".png";
59 #else
60  const std::string ext = ".bmp";
61 #endif
62  filename = filesystem::get_next_filename(filename, ext);
63  const bool res = func(filename);
64  if (res) {
65  gui2::dialogs::screenshot_notification::display(filename);
66  } else {
68  _("Screenshot creation failed.\n\n"
69  "Make sure there is enough space on the drive holding Wesnoth’s player resource files and that file permissions are set up correctly."));
70  }
71 }
72 }
73 namespace hotkey {
74 
75 static void event_execute(const SDL_Event& event, command_executor* executor);
76 
77 bool command_executor::execute_command(const hotkey_command& cmd, int /*index*/, bool press)
78 {
79  // hotkey release handling
80  if (!press) {
81  switch(cmd.id) {
82  // release a scroll key, un-apply scrolling in the given direction
83  case HOTKEY_SCROLL_UP:
84  scroll_up(false);
85  break;
86  case HOTKEY_SCROLL_DOWN:
87  scroll_down(false);
88  break;
89  case HOTKEY_SCROLL_LEFT:
90  scroll_left(false);
91  break;
93  scroll_right(false);
94  break;
95  default:
96  return false; // nothing else handles a hotkey release
97  }
98 
99  return true;
100  }
101 
102  // hotkey press handling
103  switch(cmd.id) {
104  case HOTKEY_SCROLL_UP:
105  scroll_up(true);
106  break;
107  case HOTKEY_SCROLL_DOWN:
108  scroll_down(true);
109  break;
110  case HOTKEY_SCROLL_LEFT:
111  scroll_left(true);
112  break;
113  case HOTKEY_SCROLL_RIGHT:
114  scroll_right(true);
115  break;
116  case HOTKEY_CYCLE_UNITS:
117  cycle_units();
118  break;
121  break;
122  case HOTKEY_ENDTURN:
123  end_turn();
124  break;
127  break;
129  end_unit_turn();
130  break;
131  case HOTKEY_LEADER:
132  goto_leader();
133  break;
134  case HOTKEY_UNDO:
135  undo();
136  break;
137  case HOTKEY_REDO:
138  redo();
139  break;
142  break;
145  break;
146  case HOTKEY_RENAME_UNIT:
147  rename_unit();
148  break;
149  case HOTKEY_SAVE_GAME:
150  save_game();
151  break;
152  case HOTKEY_SAVE_REPLAY:
153  save_replay();
154  break;
155  case HOTKEY_SAVE_MAP:
156  save_map();
157  break;
158  case HOTKEY_LOAD_GAME:
159  load_game();
160  break;
162  toggle_ellipses();
163  break;
164  case HOTKEY_TOGGLE_GRID:
165  toggle_grid();
166  break;
167  case HOTKEY_STATUS_TABLE:
168  status_table();
169  break;
170  case HOTKEY_RECALL:
171  recall();
172  break;
174  label_settings();
175  break;
176  case HOTKEY_RECRUIT:
177  recruit();
178  break;
180  repeat_recruit();
181  break;
182  case HOTKEY_SPEAK:
183  speak();
184  break;
185  case HOTKEY_SPEAK_ALLY:
186  whisper();
187  break;
188  case HOTKEY_SPEAK_ALL:
189  shout();
190  break;
191  case HOTKEY_CREATE_UNIT:
192  create_unit();
193  break;
194  case HOTKEY_CHANGE_SIDE:
195  change_side();
196  break;
197  case HOTKEY_KILL_UNIT:
198  kill_unit();
199  break;
200  case HOTKEY_PREFERENCES:
201  preferences();
202  break;
203  case HOTKEY_OBJECTIVES:
204  objectives();
205  break;
206  case HOTKEY_UNIT_LIST:
207  unit_list();
208  break;
209  case HOTKEY_STATISTICS:
210  show_statistics();
211  break;
212  case HOTKEY_STOP_NETWORK:
213  stop_network();
214  break;
216  start_network();
217  break;
219  label_terrain(true);
220  break;
222  label_terrain(false);
223  break;
224  case HOTKEY_CLEAR_LABELS:
225  clear_labels();
226  break;
228  show_enemy_moves(false);
229  break;
231  show_enemy_moves(true);
232  break;
233  case HOTKEY_DELAY_SHROUD:
235  break;
238  break;
240  continue_move();
241  break;
242  case HOTKEY_SEARCH:
243  search();
244  break;
245  case HOTKEY_HELP:
246  show_help();
247  break;
248  case HOTKEY_CHAT_LOG:
249  show_chat_log();
250  break;
251  case HOTKEY_USER_CMD:
252  user_command();
253  break;
254  case HOTKEY_CUSTOM_CMD:
255  custom_command();
256  break;
257  case HOTKEY_AI_FORMULA:
258  ai_formula();
259  break;
260  case HOTKEY_CLEAR_MSG:
261  clear_messages();
262  break;
263  case HOTKEY_LANGUAGE:
264  change_language();
265  break;
266  case HOTKEY_REPLAY_PLAY:
267  play_replay();
268  break;
269  case HOTKEY_REPLAY_RESET:
270  reset_replay();
271  break;
272  case HOTKEY_REPLAY_STOP:
273  stop_replay();
274  break;
277  break;
280  break;
283  break;
286  break;
289  break;
292  break;
295  break;
296  case HOTKEY_REPLAY_EXIT:
297  replay_exit();
298  break;
299  case HOTKEY_WB_TOGGLE:
301  break;
304  break;
307  break;
310  break;
313  break;
316  break;
319  break;
320  case HOTKEY_SELECT_HEX:
321  select_hex();
322  break;
323  case HOTKEY_DESELECT_HEX:
324  deselect_hex();
325  break;
326  case HOTKEY_MOVE_ACTION:
327  move_action();
328  break;
331  break;
332  case HOTKEY_ACCELERATED:
334  break;
335  case LUA_CONSOLE:
336  lua_console();
337  break;
338  case HOTKEY_ZOOM_IN:
339  zoom_in();
340  break;
341  case HOTKEY_ZOOM_OUT:
342  zoom_out();
343  break;
344  case HOTKEY_ZOOM_DEFAULT:
345  zoom_default();
346  break;
348  map_screenshot();
349  break;
352  break;
353  case HOTKEY_QUIT_GAME:
355  break;
356  case HOTKEY_SURRENDER:
357  surrender_game();
358  break;
359  default:
360  return false;
361  }
362  return true;
363 }
364 
366  if(gui2::show_message(_("Surrender"), _("Do you really want to surrender the game?"), gui2::dialogs::message::yes_no_buttons) != gui2::window::CANCEL) {
368  if(pmc && !pmc->is_linger_mode() && !pmc->is_observer()) {
369  pmc->surrender(display::get_singleton()->viewing_team());
370  }
371  }
372 }
373 
374 void command_executor::show_menu(const std::vector<config>& items_arg, int xloc, int yloc, bool /*context_menu*/, display& gui)
375 {
376  std::vector<config> items = items_arg;
377  if (items.empty()) return;
378 
379  get_menu_images(gui, items);
380 
381  int res = -1;
382  {
383  SDL_Rect pos {xloc, yloc, 1, 1};
384  gui2::dialogs::drop_down_menu mmenu(pos, items, -1, true, false); // TODO: last value should be variable
385  mmenu.show();
386  if(mmenu.get_retval() == gui2::window::OK) {
387  res = mmenu.selected_item();
388  }
389  } // This will kill the dialog.
390  if (res < 0 || size_t(res) >= items.size()) return;
391 
392  const theme::menu* submenu = gui.get_theme().get_menu_item(items[res]["id"]);
393  if (submenu) {
394  int y,x;
395  SDL_GetMouseState(&x,&y);
396  this->show_menu(submenu->items(), x, y, submenu->is_context(), gui);
397  } else {
398  const hotkey::hotkey_command& cmd = hotkey::get_hotkey_command(items[res]["id"]);
399  hotkey::execute_command(cmd,this,res);
401  }
402 }
403 
404 void command_executor::execute_action(const std::vector<std::string>& items_arg, int /*xloc*/, int /*yloc*/, bool /*context_menu*/, display&)
405 {
406  std::vector<std::string> items = items_arg;
407  if (items.empty()) {
408  return;
409  }
410 
411  std::vector<std::string>::iterator i = items.begin();
412  while(i != items.end()) {
413  const hotkey_command &command = hotkey::get_hotkey_command(*i);
414  if (can_execute_command(command)) {
415  hotkey::execute_command(command, this);
417  }
418  ++i;
419  }
420 }
421 
423 
424  // TODO: Find a way to do away with the fugly special markup
425  if(command[0] == '&') {
426  size_t n = command.find_first_of('=');
427  if(n != std::string::npos)
428  return command.substr(1, n - 1);
429  }
430 
431  const std::string base_image_name = "icons/action/" + command + "_25.png";
432  const std::string pressed_image_name = "icons/action/" + command + "_25-pressed.png";
433 
434  const hotkey::HOTKEY_COMMAND hk = hotkey::get_id(command);
435  const hotkey::ACTION_STATE state = get_action_state(hk, index);
436 
437  const theme::menu* menu = disp.get_theme().get_menu_item(command);
438  if (menu) {
439  return "icons/arrows/short_arrow_right_25.png~CROP(3,3,18,18)"; // TODO should not be hardcoded
440  }
441 
442  if (filesystem::file_exists(game_config::path + "/images/" + base_image_name)) {
443  switch (state) {
444  case ACTION_ON:
445  case ACTION_SELECTED:
446  return pressed_image_name + "~CROP(3,3,18,18)";
447  default:
448  return base_image_name + "~CROP(3,3,18,18)";
449  }
450  }
451 
452  switch (get_action_state(hk, index)) {
453  case ACTION_ON:
455  case ACTION_OFF:
457  case ACTION_SELECTED:
459  case ACTION_DESELECTED:
461  default: return get_action_image(hk, index);
462  }
463 }
464 
465 void command_executor::get_menu_images(display& disp, std::vector<config>& items)
466 {
467  for(size_t i = 0; i < items.size(); ++i) {
468  config& item = items[i];
469 
470  const std::string& item_id = item["id"];
471  const hotkey::HOTKEY_COMMAND hk = hotkey::get_id(item_id);
472 
473  //see if this menu item has an associated image
474  std::string img(get_menu_image(disp, item_id, i));
475  if (img.empty() == false) {
476  item["icon"] = img;
477  }
478 
479  const theme::menu* menu = disp.get_theme().get_menu_item(item_id);
480  if(menu) {
481  item["label"] = menu->title();
482  } else if(hk != hotkey::HOTKEY_NULL) {
483  std::string desc = hotkey::get_description(item_id);
484  if(hk == HOTKEY_ENDTURN) {
485  const theme::action *b = disp.get_theme().get_action_item("button-endturn");
486  if (b) {
487  desc = b->title();
488  }
489  }
490 
491  item["label"] = desc;
492  item["details"] = hotkey::get_names(item_id);
493  } else if(item["label"].empty()) {
494  // If no matching hotkey was found and a custom label wasn't already set, treat
495  // the id as a plaintext description. This is because either type of value can
496  // be written to the id field by the WMI manager. The plaintext description is
497  // used in the case the menu item specifies the relevant entry is *not* a hotkey.
498  item["label"] = item_id;
499  }
500  }
501 }
502 
503 void mbutton_event(const SDL_Event& event, command_executor* executor)
504 {
505  event_execute(event, executor);
506 }
507 
508 void jbutton_event(const SDL_Event& event, command_executor* executor)
509 {
510  event_execute(event, executor);
511 }
512 
513 void jhat_event(const SDL_Event& event, command_executor* executor)
514 {
515  event_execute(event, executor);
516 }
517 
518 void key_event(const SDL_Event& event, command_executor* executor)
519 {
520  if (!executor) return;
521  event_execute(event,executor);
522 }
523 
524 static void event_execute( const SDL_Event& event, command_executor* executor)
525 {
526  if (!executor) return;
527  const hotkey_ptr hk = get_hotkey(event);
528  if (!hk->active() || hk->is_disabled()) {
529  return;
530  }
531 
532  bool press = event.type == SDL_KEYDOWN ||
533  event.type == SDL_JOYBUTTONDOWN ||
534  event.type == SDL_MOUSEBUTTONDOWN ||
535  event.type == SDL_TEXTINPUT;
536 
537  execute_command(hotkey::get_hotkey_command(hk->get_command()), executor, -1, press);
538  executor->set_button_state();
539 }
540 
541 void execute_command(const hotkey_command& command, command_executor* executor, int index, bool press)
542 {
543  assert(executor != nullptr);
544 
545  if (!executor->can_execute_command(command, index)
546  || executor->execute_command(command, index, press)) {
547  return;
548  }
549 
550  if (!press) {
551  return; // none of the commands here respond to a key release
552  }
553 
554  switch (command.id) {
555 
558  executor->recalculate_minimap();
559  break;
562  executor->recalculate_minimap();
563  break;
566  executor->recalculate_minimap();
567  break;
570  executor->recalculate_minimap();
571  break;
574  executor->recalculate_minimap();
575  break;
576  case HOTKEY_FULLSCREEN:
578  break;
579  case HOTKEY_SCREENSHOT:
580  make_screenshot(_("Screenshot"), &::screenshot);
581  break;
582  case HOTKEY_ANIMATE_MAP:
584  break;
585  case HOTKEY_MOUSE_SCROLL:
587  break;
588  case HOTKEY_MUTE:
589  {
590  // look if both is not playing
591  static struct before_muted_s
592  {
593  bool playing_sound,playing_music;
594  before_muted_s() : playing_sound(false),playing_music(false){}
595  } before_muted;
597  {
598  // then remember settings and mute both
599  before_muted.playing_sound = preferences::sound_on();
600  before_muted.playing_music = preferences::music_on();
601  preferences::set_sound(false);
602  preferences::set_music(false);
603  }
604  else
605  {
606  // then set settings before mute
607  preferences::set_sound(before_muted.playing_sound);
608  preferences::set_music(before_muted.playing_music);
609  }
610  }
611  break;
612  default:
613  DBG_G << "command_executor: unknown command number " << command.id << ", ignoring.\n";
614  break;
615  }
616 }
617 
619 {
620  display& disp = get_display();
621  for (const theme::menu& menu : disp.get_theme().menus()) {
622 
623  std::shared_ptr<gui::button> button = disp.find_menu_button(menu.get_id());
624  if (!button) continue;
625  bool enabled = false;
626  for (const auto& command : menu.items()) {
627 
628  const hotkey::hotkey_command& command_obj = hotkey::get_hotkey_command(command["id"]);
629  bool can_execute = can_execute_command(command_obj);
630  if (can_execute) {
631  enabled = true;
632  break;
633  }
634  }
635  button->enable(enabled);
636  }
637 
638  for (const theme::action& action : disp.get_theme().actions()) {
639 
640  std::shared_ptr<gui::button> button = disp.find_action_button(action.get_id());
641  if (!button) continue;
642  bool enabled = false;
643  int i = 0;
644  for (const std::string& command : action.items()) {
645 
646  const hotkey::hotkey_command& command_obj = hotkey::get_hotkey_command(command);
647  std::string tooltip = action.tooltip(i);
648  if (filesystem::file_exists(game_config::path + "/images/icons/action/" + command + "_25.png" ))
649  button->set_overlay("icons/action/" + command);
650  if (!tooltip.empty())
651  button->set_tooltip_string(tooltip);
652 
653  bool can_execute = can_execute_command(command_obj);
654  i++;
655  if (!can_execute) continue;
656  enabled = true;
657 
658  ACTION_STATE state = get_action_state(command_obj.id, -1);
659  switch (state) {
660  case ACTION_SELECTED:
661  case ACTION_ON:
662  button->set_check(true);
663  break;
664  case ACTION_OFF:
665  case ACTION_DESELECTED:
666  button->set_check(false);
667  break;
668  case ACTION_STATELESS:
669  break;
670  default:
671  break;
672  }
673 
674  break;
675  }
676  button->enable(enabled);
677  }
678 }
679 
681 {
683 }
684 
686 {
687  if (get_display().in_game()) {
689  } else {
691  }
692 
693 }
694 
696 {
698 }
699 
701 {
702  if(!get_display().view_locked()) {
703  get_display().set_zoom(true);
704  }
705 }
706 
708 {
709  if(!get_display().view_locked()) {
710  get_display().set_zoom(false);
711  }
712 }
713 
715 {
716  if(!get_display().view_locked()) {
718  }
719 }
720 
722 {
723  make_screenshot(_("Map-Screenshot"), [this](const std::string& filename) {
724  return get_display().screenshot(filename, true);
725  });
726 }
727 }
std::shared_ptr< gui::button > find_action_button(const std::string &id)
Retrieves a pointer to a theme UI button.
Definition: display.cpp:844
play_controller * controller
Definition: resources.cpp:21
bool set_sound(bool ison)
Definition: general.cpp:665
virtual void toggle_shroud_updates()
void show_message(const std::string &title, const std::string &msg, const std::string &button_caption, const bool auto_close, const bool message_use_markup, const bool title_use_markup)
Shows a message to the user.
Definition: message.cpp:152
Dialog is closed with ok button.
Definition: window.hpp:101
std::vector< char_t > string
size_t index(const utf8::string &str, const size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
Definition: unicode.cpp:71
static display * get_singleton()
Returns the display object if a display object exists.
Definition: display.hpp:87
HOTKEY_COMMAND id
the names are strange: the "hotkey::HOTKEY_COMMAND" is named id, and the string to identify the objec...
const std::string & title() const
Definition: theme.hpp:222
virtual ACTION_STATE get_action_state(hotkey::HOTKEY_COMMAND, int) const
std::string get_next_filename(const std::string &name, const std::string &extension)
Get the next free filename using "name + number (3 digits) + extension" maximum 1000 files then start...
theme & get_theme()
Definition: display.hpp:375
void surrender(int side_number)
static void quit_to_title()
bool set_zoom(bool increase)
Zooms the display in (true) or out (false).
Definition: display.cpp:2020
void set_default_zoom()
Sets the zoom amount to the default.
Definition: display.cpp:2088
This file contains the window object, this object is a top level container which has the event manage...
std::string selected_menu
General purpose widgets.
void enable_mouse_scroll(bool value)
Definition: general.cpp:885
Stores all information related to functions that can be bound to hotkeys.
virtual void terrain_description()
std::string get_screenshot_dir()
const std::vector< menu > & menus() const
Definition: theme.hpp:246
static CVideo & get_singleton()
Definition: video.hpp:43
void mbutton_event(const SDL_Event &event, command_executor *executor)
std::string unchecked_menu
const std::vector< std::string > items
virtual void recalculate_minimap()
Contains the exception interfaces used to signal completion of a scenario, campaign or turn...
bool show(const unsigned auto_close_time=0)
Shows the window.
virtual void whiteboard_execute_action()
virtual void scroll_up(bool)
static void event_execute(const SDL_Event &event, command_executor *executor)
bool sound_on()
Definition: general.cpp:660
Keyboard shortcuts for game actions.
virtual void whiteboard_delete_action()
virtual bool can_execute_command(const hotkey_command &command, int index=-1) const =0
bool save_image(const locator &i_locator, const std::string &filename)
Definition: image.cpp:1198
static void display(lua_kernel_base *lk)
Display a new console, using given video and lua kernel.
virtual void whiteboard_bump_up_action()
virtual void label_terrain(bool)
#define b
static lg::log_domain log_config("config")
std::string get_names(const std::string &id)
Returns a comma-separated string of hotkey names.
static UNUSEDNOWARN std::string _(const char *str)
Definition: gettext.hpp:89
std::string deselected_menu
virtual display & get_display()=0
void execute_command(const hotkey_command &command, command_executor *executor, int index, bool press)
void get_menu_images(display &, std::vector< config > &items)
virtual void replay_show_team1()
void jbutton_event(const SDL_Event &event, command_executor *executor)
void toggle_minimap_draw_units()
Definition: general.cpp:930
const hotkey_ptr get_hotkey(const SDL_Event &event)
Iterate through the list of hotkeys and return a hotkey that matches the SDL_Event and the current ke...
virtual void unit_hold_position()
void recalculate_minimap()
Schedule the minimap for recalculation.
Definition: display.hpp:612
virtual void scroll_right(bool)
Used by the menu_button widget.
virtual void show_menu(const std::vector< config > &items_arg, int xloc, int yloc, bool context_menu, display &gui)
virtual void show_enemy_moves(bool)
const menu * get_menu_item(const std::string &key) const
Definition: theme.cpp:905
std::string path
Definition: game_config.cpp:56
Shows a yes and no button.
Definition: message.hpp:79
void toggle_minimap_draw_terrain()
Definition: general.cpp:950
map_display and display: classes which take care of displaying the map and game-data on the screen...
bool animate_map()
Definition: general.cpp:895
bool is_observer() const
void set_animate_map(bool value)
Definition: general.cpp:955
void jhat_event(const SDL_Event &event, command_executor *executor)
void toggle_minimap_draw_villages()
Definition: general.cpp:940
const std::string & title() const
Definition: theme.hpp:167
static void quit_to_desktop()
const std::vector< action > & actions() const
Definition: theme.hpp:248
virtual void scroll_left(bool)
virtual void update_shroud_now()
void toggle_minimap_terrain_coding()
Definition: general.cpp:920
void execute_action(const std::vector< std::string > &items_arg, int xloc, int yloc, bool context_menu, display &gui)
const std::vector< config > & items() const
Definition: theme.hpp:230
void toggle_fullscreen()
Definition: video.cpp:552
virtual void replay_show_everything()
std::string get_menu_image(display &disp, const std::string &command, int index=-1) const
bool music_on()
Definition: general.cpp:683
virtual void scroll_down(bool)
size_t i
Definition: function.cpp:933
void toggle_minimap_movement_coding()
Definition: general.cpp:910
Declarations for File-IO.
std::shared_ptr< hotkey_base > hotkey_ptr
Definition: hotkey_item.hpp:30
virtual void whiteboard_suppose_dead()
void key_event(const SDL_Event &event, command_executor *executor)
const action * get_action_item(const std::string &key) const
Definition: theme.cpp:914
const std::string & get_description(const std::string &command)
virtual void whiteboard_bump_down_action()
virtual bool execute_command(const hotkey_command &command, int index=-1, bool press=true)
bool mouse_scroll_enabled()
Definition: general.cpp:880
virtual void whiteboard_execute_all_actions()
bool set_music(bool ison)
Definition: general.cpp:688
Standard logging facilities (interface).
#define DBG_G
bool is_context() const
Definition: theme.hpp:220
static const char * name(const std::vector< SDL_Joystick * > &joysticks, const size_t index)
Definition: joystick.cpp:48
virtual std::string get_action_image(hotkey::HOTKEY_COMMAND, int) const
void show_error_message(const std::string &msg, bool message_use_markup)
Shows an error message to the user.
Definition: message.cpp:205
std::string checked_menu
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:93
const hotkey_command & get_hotkey_command(const std::string &command)
returns the hotkey_command with the given name
static map_location::DIRECTION n
bool file_exists(const std::string &name)
Returns true if a file or directory with such name already exists.
Dialog is closed with the cancel button.
Definition: window.hpp:102
std::string::const_iterator iterator
Definition: tokenizer.hpp:24
bool is_linger_mode() const
std::shared_ptr< gui::button > find_menu_button(const std::string &id)
Definition: display.cpp:854
HOTKEY_COMMAND get_id(const std::string &command)
returns get_hotkey_command(command).id
virtual void replay_skip_animation()
virtual void whiteboard_toggle()
virtual void toggle_accelerated_speed()
bool screenshot(const std::string &filename, bool map_screenshot=false)
Save a (map-)screenshot and return whether the operation succeeded.
Definition: display.cpp:771