The Battle for Wesnoth  1.19.1+dev
preferences.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2024 - 2024
3  Part of the Battle for Wesnoth Project https://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 
15 #pragma once
16 
17 #include "config.hpp"
18 #include "filesystem.hpp"
19 #include "game_config.hpp"
20 #include "gui/sort_order.hpp"
23 #include "team.hpp"
24 #include "terrain/translation.hpp"
25 #include "lua/wrapper_lua.h" // for lua_State arguments to friend functions
26 #include "log.hpp"
27 #include <set>
28 
29 struct point;
30 class unit_map;
31 class game_board;
32 
33 namespace pref_constants
34 {
35 const int min_window_width = 800;
36 const int min_window_height = 540;
37 
38 const int def_window_width = 1280;
39 const int def_window_height = 720;
40 
41 const int max_window_width = 1920;
42 const int max_window_height = 1080;
43 
44 const int min_font_scaling = 80;
45 const int max_font_scaling = 150;
46 
47 const int min_pixel_scale = 1;
48 const int max_pixel_scale = 4;
49 
50 const int TRANSITION_UPDATE_OFF = 0;
51 const int TRANSITION_UPDATE_ON = 1;
54 
55 const unsigned char CREDENTIAL_SEPARATOR = '\f';
56 const std::string EMPTY_LOGIN = "@@";
57 
58 const int INFINITE_AUTO_SAVES = 61;
59 
60 const std::string default_addons_server = "add-ons.wesnoth.org";
61 
63 
65 };
66 
67 namespace preferences
68 {
70 {
71 public:
73  {
74  }
75 
76  explicit acquaintance(const config& cfg)
77  {
78  nick_ = cfg["nick"].str();
79  status_ = cfg["status"].str();
80  notes_ = cfg["notes"].str();
81  }
82 
83  acquaintance(const std::string& nick, const std::string& status, const std::string& notes)
84  : nick_(nick)
85  , status_(status)
86  , notes_(notes)
87  {
88  }
89 
90  const std::string& get_nick() const { return nick_; }
91  const std::string& get_status() const { return status_; }
92  const std::string& get_notes() const { return notes_; }
93 
94  void save(config& item)
95  {
96  item["nick"] = nick_;
97  item["status"] = status_;
98  item["notes"] = notes_;
99  }
100 
101 private:
102  /** acquaintance's MP nick */
103  std::string nick_;
104 
105  /**status (e.g., "friend", "ignore") */
106  std::string status_;
107 
108  /** notes on the acquaintance */
109  std::string notes_;
110 };
111 
112 class secure_buffer : public std::vector<unsigned char>
113 {
114 public:
115  template<typename... T> secure_buffer(T&&... args)
116  : vector<unsigned char>(std::forward<T>(args)...)
117  {}
119  {
120  std::fill(begin(), end(), '\0');
121  }
122 };
123 
125 {
126  std::string username, server;
128  login_info(const std::string& username, const std::string& server, const secure_buffer& key)
130  {}
131  login_info(const std::string& username, const std::string& server)
133  {}
134  std::size_t size() const
135  {
136  return 3 + username.size() + server.size() + key.size();
137  }
138 };
139 
140 struct option
141 {
142  option(const config& pref)
143  : type()
144  , name(pref["name"].t_str())
145  , description(pref["description"].t_str())
146  , field(pref["field"].str())
147  , cfg(pref)
148  {
149  const std::string p_type = cfg["type"];
150 
151  if(p_type == "boolean") {
153  } else if(p_type == "int") {
155  } else if(p_type == "combo") {
157  } else if(p_type == "custom") {
159  } else {
160  throw std::invalid_argument("Unknown type '" + p_type + "' for advanced preference " + name);
161  }
162  }
163 
164  enum class avd_type { TOGGLE, SLIDER, COMBO, SPECIAL };
165 
166  /** The preference type. */
168 
169  /** Displayed name. */
171 
172  /** Displayed description. */
174 
175  /** The actual field saved in the prefs file and by which this preference may be accessed. */
176  std::string field;
177 
178  /** The full config, including type-specific options. */
180 };
181 };
182 
183 class prefs
184 {
186  friend int impl_preferences_set(lua_State* L);
187  friend int impl_preferences_get(lua_State* L);
188 
189  public:
190  static prefs& get()
191  {
192  static prefs prefs_manager;
193  return prefs_manager;
194  }
195 
196  ~prefs();
197 
198  void write_preferences();
199  void load_advanced_prefs(const game_config_view& gc);
200  void migrate_preferences(const std::string& prefs_dir);
201  void reload_preferences();
202  std::set<std::string> all_attributes();
203 
204  std::string core_id();
205  void set_core_id(const std::string& root);
206 
207  bool scroll_to_action();
208  void set_scroll_to_action(bool ison);
209 
210  point resolution();
211  void set_resolution(const point& res);
212 
213  int pixel_scale();
214  void set_pixel_scale(const int scale);
215 
216  bool auto_pixel_scale();
217  void set_auto_pixel_scale(bool choice);
218 
219  bool maximized();
220  void set_maximized(bool ison);
221 
222  bool fullscreen();
223  void set_fullscreen(bool ison);
224 
225  bool vsync();
226  void set_vsync(bool ison);
227 
228  bool turbo();
229  void set_turbo(bool ison);
230 
231  double turbo_speed();
232  void set_turbo_speed(const double speed);
233 
234  int font_scaling();
235  void set_font_scaling(int scale);
236  int font_scaled(int size);
237 
238  int keepalive_timeout();
239  void keepalive_timeout(int seconds);
240 
241  bool idle_anim();
242  void set_idle_anim(const bool ison);
243 
244  int idle_anim_rate();
245  void set_idle_anim_rate(int rate);
246 
247  std::string language();
248  void set_language(const std::string& s);
249 
250  std::string gui_theme();
251  void set_gui_theme(const std::string& s);
252 
253  // Don't rename it to sound() because of a gcc-3.3 branch bug which will cause it to conflict with the sound namespace.
254  bool sound_on();
255  bool set_sound(bool ison);
256 
257  unsigned int sample_rate();
258  void save_sample_rate(const unsigned int rate);
259 
260  std::size_t sound_buffer_size();
261  void save_sound_buffer_size(const std::size_t size);
262 
263  int sound_volume();
264  void set_sound_volume(int vol);
265 
266  int bell_volume();
267  void set_bell_volume(int vol);
268 
269  int ui_volume();
270  void set_ui_volume(int vol);
271 
272  bool music_on();
273  bool set_music(bool ison);
274 
275  int music_volume();
276  void set_music_volume(int vol);
277 
279  void set_stop_music_in_background(bool ison);
280 
281  unsigned int tile_size();
282  void set_tile_size(const unsigned int size);
283 
284  bool turn_bell();
285  bool set_turn_bell(bool ison);
286 
287  bool ui_sound_on();
288  bool set_ui_sound(bool ison);
289 
290  bool message_bell();
291 
292  // Proxies for preferences_dialog
293  void load_hotkeys();
294  void save_hotkeys();
295  void clear_hotkeys();
296 
297  void add_alias(const std::string& alias, const std::string& command);
299 
300  std::string allied_color();
301  void set_allied_color(const std::string& color_id);
302 
303  std::string enemy_color();
304  void set_enemy_color(const std::string& color_id);
305 
306  std::string unmoved_color();
307  void set_unmoved_color(const std::string& color_id);
308 
309  std::string partial_color();
310  void set_partial_color(const std::string& color_id);
311 
312  std::string moved_color();
313  void set_moved_color(const std::string& color_id);
314 
315  bool show_ally_orb();
316  void set_show_ally_orb(bool show_orb);
317 
319  void set_show_status_on_ally_orb(bool show_orb);
320 
321  bool show_enemy_orb();
322  void set_show_enemy_orb(bool show_orb);
323 
324  bool show_moved_orb();
325  void set_show_moved_orb(bool show_orb);
326 
327  bool show_unmoved_orb();
328  void set_show_unmoved_orb(bool show_orb);
329 
330  bool show_partial_orb();
331  void set_show_partial_orb(bool show_orb);
332 
333  bool show_disengaged_orb();
334  void set_show_disengaged_orb(bool show_orb);
335 
336  int scroll_speed();
337  void set_scroll_speed(const int scroll);
338 
339  bool middle_click_scrolls();
340  bool mouse_scroll_enabled();
341  void enable_mouse_scroll(bool value);
342 
343  /**
344  * Gets the threshold for when to scroll.
345  *
346  * This scrolling happens when the mouse is in the application and near the border.
347  */
349 
350  int draw_delay();
351  void set_draw_delay(int value);
352 
353  bool animate_map();
354  void set_animate_map(bool value);
355 
356  bool animate_water();
357  void set_animate_water(bool value);
358 
361 
362  bool minimap_terrain_coding();
364 
365  bool minimap_draw_units();
367 
368  bool minimap_draw_villages();
370 
371  bool minimap_draw_terrain();
373 
374  bool show_fps();
375  void set_show_fps(bool value);
376 
377  bool ellipses();
378  void set_ellipses(bool ison);
379 
380  bool grid();
381  void set_grid(bool ison);
382 
384 
386 
387  bool disable_auto_moves();
388  void set_disable_auto_moves(bool value);
389 
392 
393  std::string addon_manager_saved_order_name();
394  void set_addon_manager_saved_order_name(const std::string& value);
395 
398 
399  std::string selected_achievement_group();
400  void set_selected_achievement_group(const std::string& content_for);
401 
402  /**
403  * @param content_for The achievement group the achievement is part of.
404  * @param id The ID of the achievement within the achievement group.
405  * @return True if the achievement exists and is completed, false otherwise.
406  */
407  bool achievement(const std::string& content_for, const std::string& id);
408  /**
409  * Marks the specified achievement as completed.
410  *
411  * @param content_for The achievement group the achievement is part of.
412  * @param id The ID of the achievement within the achievement group.
413  */
414  void set_achievement(const std::string& content_for, const std::string& id);
415 
416  /**
417  * Increments the achievement's current progress by @a amount if it hasn't already been completed.
418  * If you only want to check the achievement's current progress, then omit the last three arguments.
419  * @a amount defaults to 0, which will result in the current progress value being returned without being changed (x + 0 == x).
420  *
421  * Note that this uses the same [in_progress] as is used for set_sub_achievement().
422  *
423  * @param content_for The id of the achievement group this achievement is in.
424  * @param id The id for the specific achievement in the achievement group.
425  * @param limit The maximum value that a specific call to this function can increase the achievement progress value.
426  * @param max_progress The value when the achievement is considered completed.
427  * @param amount The amount to progress the achievement.
428  * @return The achievement's current progress, or -1 if it has already been completed.
429  */
430  int progress_achievement(const std::string& content_for, const std::string& id, int limit = 999999, int max_progress = 999999, int amount = 0);
431 
432  /**
433  * @param content_for The achievement group the achievement is part of.
434  * @param id The ID of the achievement within the achievement group.
435  * @param sub_id The ID of the sub-achievement within the achievement.
436  * @return True if the sub-achievement exists and is completed, false otherwise.
437  */
438  bool sub_achievement(const std::string& content_for, const std::string& id, const std::string& sub_id);
439 
440  /**
441  * Marks the specified sub-achievement as completed.
442  *
443  * Note that this uses the same [in_progress] as is used for progress_achievement().
444  *
445  * @param content_for The achievement group the achievement is part of.
446  * @param id The ID of the achievement within the achievement group.
447  * @param sub_id The ID of the sub-achievement within the achievement.
448  */
449  void set_sub_achievement(const std::string& content_for, const std::string& id, const std::string& sub_id);
450 
451  /**
452  * @param addon_id The chosen addon id from the editor to store in the preferences.
453  */
454  void set_editor_chosen_addon(const std::string& addon_id);
455 
456  /**
457  * @return The most recently selected add-on id from the editor. May be an empty string.
458  */
459  std::string editor_chosen_addon();
460 
461  void set_last_cache_cleared_version(const std::string& version);
462  std::string last_cache_cleared_version();
463 
464  bool get_show_deprecation(bool def);
465 
466  bool get_scroll_when_mouse_outside(bool def);
467 
468  void set_dir_bookmarks(const config& cfg);
470 
471  bool whisper_friends_only();
472  void set_whisper_friends_only(bool v);
473 
475 
476  bool fi_invert();
477  void set_fi_invert(bool value);
478 
479  bool fi_vacant_slots();
480  void set_fi_vacant_slots(bool value);
481 
482  bool fi_friends_in_game();
483  void set_fi_friends_in_game(bool value);
484 
485  bool fi_blocked_in_game();
486  void set_fi_blocked_in_game(bool value);
487 
489  void set_editor_auto_update_transitions(int value);
490 
491  std::string default_dir();
492 
494  void set_editor_draw_terrain_codes(bool value);
495 
497  void set_editor_draw_hex_coordinates(bool value);
498 
500  void set_editor_draw_num_of_bitmaps(bool value);
501 
502  std::size_t editor_mru_limit();
503  std::vector<std::string> do_read_editor_mru();
504  void do_commit_editor_mru(const std::vector<std::string>& mru);
505  /** Retrieves the list of recently opened files. */
506  std::vector<std::string> recent_files();
507  /** Adds an entry to the recent files list. */
508  void add_recent_files_entry(const std::string& path);
509 
510  bool use_color_cursors();
511  void set_color_cursors(bool value);
512 
514  void set_show_standing_animations(bool value);
515 
517  bool show_theme_dialog();
518 
519  void set_theme(const std::string& theme);
520  std::string theme();
521 
522  void set_mp_server_program_name(const std::string&);
523  std::string get_mp_server_program_name();
524 
525  bool parse_should_show_lobby_join(const std::string& sender, const std::string& message);
528 
529  const std::map<std::string, preferences::acquaintance>& get_acquaintances();
530  const std::string get_ignored_delim();
531  std::map<std::string, std::string> get_acquaintances_nice(const std::string& filter);
532  std::pair<preferences::acquaintance*, bool> add_acquaintance(const std::string& nick, const std::string& mode, const std::string& notes);
533  void add_completed_campaign(const std::string&campaign_id, const std::string& difficulty_level);
534  bool remove_acquaintance(const std::string& nick);
535  bool is_friend(const std::string& nick);
536  bool is_ignored(const std::string& nick);
537  bool is_campaign_completed(const std::string& campaign_id);
538  bool is_campaign_completed(const std::string& campaign_id, const std::string& difficulty_level);
539 
540  const std::vector<game_config::server_info>& builtin_servers_list();
541  std::vector<game_config::server_info> user_servers_list();
542  void set_user_servers_list(const std::vector<game_config::server_info>& value);
543 
544  std::string network_host();
545  void set_network_host(const std::string& host);
546 
547  std::string campaign_server();
548  void set_campaign_server(const std::string& host);
549 
550  bool turn_dialog();
551  void set_turn_dialog(bool ison);
552 
554  void set_enable_whiteboard_mode_on_start(bool value);
555 
556  bool hide_whiteboard();
557  void set_hide_whiteboard(bool value);
558 
559  bool show_combat();
560 
561  bool allow_observers();
562  void set_allow_observers(bool value);
563 
564  bool shuffle_sides();
565  void set_shuffle_sides(bool value);
566 
567  std::string random_faction_mode();
568  void set_random_faction_mode(const std::string& value);
569 
570  bool use_map_settings();
571  void set_use_map_settings(bool value);
572 
574  void set_mp_server_warning_disabled(int value);
575 
576  bool random_start_time();
577  void set_random_start_time(bool value);
578 
579  bool fog();
580  void set_fog(bool value);
581 
582  bool shroud();
583  void set_shroud(bool value);
584 
585  int turns();
586  void set_turns(int value);
587 
588  const config& options();
589  void set_options(const config& values);
590 
591  bool skip_mp_replay();
592  void set_skip_mp_replay(bool value);
593 
594  bool blindfold_replay();
595  void set_blindfold_replay(bool value);
596 
597  bool countdown();
598  void set_countdown(bool value);
599  int countdown_init_time();
600  void set_countdown_init_time(int value);
602 
603  int countdown_turn_bonus();
604  void set_countdown_turn_bonus(int value);
606 
608  void set_countdown_reservoir_time(int value);
610 
612  void set_countdown_action_bonus(int value);
614 
615  int village_gold();
616  void set_village_gold(int value);
617 
618  int village_support();
619  void set_village_support(int value);
620 
621  int xp_modifier();
622  void set_xp_modifier(int value);
623 
624  std::string era();
625  void set_era(const std::string& value);
626 
627  std::string level();
628  void set_level(const std::string& value);
629  int level_type();
630  void set_level_type(int value);
631 
632  const std::vector<std::string>& modifications(bool mp = true);
633  void set_modifications(const std::vector<std::string>& value, bool mp = true);
634 
635  bool skip_ai_moves();
636  void set_skip_ai_moves(bool value);
637 
638  void set_show_side_colors(bool value);
639  bool show_side_colors();
640 
641  bool save_replays();
642  void set_save_replays(bool value);
643 
644  bool delete_saves();
645  void set_delete_saves(bool value);
646 
647  void set_ask_delete_saves(bool value);
648  bool ask_delete_saves();
649 
650  void set_interrupt_when_ally_sighted(bool value);
652 
653  void set_autosavemax(int value);
654  int autosavemax();
655 
656  bool show_floating_labels();
657  void set_show_floating_labels(bool value);
658 
659  bool message_private();
660  void set_message_private(bool value);
661 
662  // Multiplayer functions
663  std::string get_chat_timestamp(const std::time_t& t);
664  bool chat_timestamping();
665  void set_chat_timestamping(bool value);
666 
667  int chat_lines();
668  void set_chat_lines(int lines);
669 
670  int chat_message_aging();
671  void set_chat_message_aging(const int aging);
672 
673  bool show_all_units_in_help();
674  void set_show_all_units_in_help(bool value);
675 
677 
678  std::set<std::string>& encountered_units();
679  std::set<t_translation::terrain_code>& encountered_terrains();
680 
681  std::string custom_command();
682  void set_custom_command(const std::string& command);
683 
684  std::vector<std::string>* get_history(const std::string& id);
685 
686  // Ask for end turn confirmation
687  bool yellow_confirm();
688  bool green_confirm();
689  bool confirm_no_moves();
690 
691  // Add all recruitable units as encountered so that information
692  // about them are displayed to the user in the help system.
693  void encounter_recruitable_units(const std::vector<team>& teams);
694 
695  // Add all units that exist at the start to the encountered units so
696  // that information about them are displayed to the user in the help
697  // system.
698  void encounter_start_units(const unit_map& units);
699 
700  // Add all units that are recallable as encountered units.
701  void encounter_recallable_units(const std::vector<team>& teams);
702 
703  // Add all terrains on the map as encountered terrains.
704  void encounter_map_terrain(const gamemap& map);
705 
706  // Calls all of the above functions on the current game board
707  void encounter_all_content(const game_board& gb);
708 
709  bool player_joins_sound();
710  void set_player_joins_sound(bool val);
711  bool player_joins_lobby();
712  void set_player_joins_lobby(bool val);
713  bool player_joins_notif();
714  void set_player_joins_notif(bool val);
715 
716  bool player_leaves_sound();
717  void set_player_leaves_sound(bool val);
718  bool player_leaves_lobby();
719  void set_player_leaves_lobby(bool val);
720  bool player_leaves_notif();
721  void set_player_leaves_notif(bool val);
722 
723  bool private_message_sound();
724  void set_private_message_sound(bool val);
725  bool private_message_lobby();
726  void set_private_message_lobby(bool val);
727  bool private_message_notif();
728  void set_private_message_notif(bool val);
729 
730  bool friend_message_sound();
731  void set_friend_message_sound(bool val);
732  bool friend_message_lobby();
733  void set_friend_message_lobby(bool val);
734  bool friend_message_notif();
735  void set_friend_message_notif(bool val);
736 
737  bool public_message_sound();
738  void set_public_message_sound(bool val);
739  bool public_message_lobby();
740  void set_public_message_lobby(bool val);
741  bool public_message_notif();
742  void set_public_message_notif(bool val);
743 
744  bool server_message_sound();
745  void set_server_message_sound(bool val);
746  bool server_message_lobby();
747  void set_server_message_lobby(bool val);
748  bool server_message_notif();
749  void set_server_message_notif(bool val);
750 
751  bool ready_for_start_sound();
752  void set_ready_for_start_sound(bool val);
753  bool ready_for_start_lobby();
754  void set_ready_for_start_lobby(bool val);
755  bool ready_for_start_notif();
756  void set_ready_for_start_notif(bool val);
757 
758  bool game_has_begun_sound();
759  void set_game_has_begun_sound(bool val);
760  bool game_has_begun_lobby();
761  void set_game_has_begun_lobby(bool val);
762  bool game_has_begun_notif();
763  void set_game_has_begun_notif(bool val);
764 
765  bool turn_changed_sound();
766  void set_turn_changed_sound(bool val);
767  bool turn_changed_lobby();
768  void set_turn_changed_lobby(bool val);
769  bool turn_changed_notif();
770  void set_turn_changed_notif(bool val);
771 
772  bool game_created_sound();
773  void set_game_created_sound(bool val);
774  bool game_created_lobby();
775  void set_game_created_lobby(bool val);
776  bool game_created_notif();
777  void set_game_created_notif(bool val);
778 
779  void clear_mp_alert_prefs();
780 
781  bool remember_password();
782  void set_remember_password(bool remember);
783 
784  std::string login();
785  void set_login(const std::string& login);
786 
787  std::string password(const std::string& server, const std::string& login);
788  void set_password(const std::string& server, const std::string& login, const std::string& key);
789 
790  std::vector<preferences::option>& get_advanced_preferences() {return advanced_prefs_;}
791 
792  static void disable_preferences_save() {
793  no_preferences_save = true;
794  }
795 
796  static bool preferences_save() {
797  return no_preferences_save;
798  }
799 
800  private:
801  prefs();
802  // don't move, assign, or copy a singleton
803  prefs(const prefs& p) = delete;
804  prefs& operator=(const prefs& p) = delete;
805  prefs(const prefs&& p) = delete;
806  prefs& operator=(const prefs&& p) = delete;
807 
808  inline static bool no_preferences_save = false;
809 
811  bool fps_;
812  std::map<std::string, std::set<std::string>> completed_campaigns_;
813  std::set<std::string> encountered_units_set_;
814  std::set<t_translation::terrain_code> encountered_terrains_set_;
815  std::map<std::string, std::vector<std::string>> history_map_;
816  std::map<std::string, preferences::acquaintance> acquaintances_;
819  std::vector<std::string> mp_modifications_;
821  std::vector<std::string> sp_modifications_;
824  std::vector<preferences::login_info> credentials_;
825  std::vector<preferences::option> advanced_prefs_;
826 
827  void load_preferences();
829  void load_credentials();
830  void save_credentials();
831  void clear_credentials();
832 
833  void set_child(const std::string& key, const config& val);
834  optional_const_config get_child(const std::string &key);
835  std::string get(const std::string& key, const std::string& def);
836  config::attribute_value get_as_attribute(const std::string& key);
837 
838  std::string get_system_username();
839  /**
840  * Encrypts the value of @a text using @a key and a hard coded IV using AES.
841  * Max size of @a text must not be larger than 1008 bytes.
842  *
843  * NOTE: This is not meant to provide strong protections against a determined attacker.
844  * This is meant to hide the passwords from malware scanning files for passwords, family/friends poking around, etc.
845  *
846  * @param text The original unencrypted data.
847  * @param key The value to use to encrypt the data. See build_key() for key generation.
848  * @return secure_buffer The encrypted data.
849  */
851  /**
852  * Same as aes_encrypt(), except of course it takes encrypted data as an argument and returns decrypted data.
853  */
855  /**
856  * Fills a secure_buffer with 32 bytes of deterministically generated bytes, then overwrites it with the system login name, server login name, and server name.
857  * If this is more than 32 bytes, then it's truncated. If it's less than 32 bytes, then the pre-generated bytes are used to pad it.
858  *
859  * @param server The server being logged into.
860  * @param login The username being used to login.
861  * @return secure_buffer The data to be used as the encryption key.
862  */
863  preferences::secure_buffer build_key(const std::string& server, const std::string& login);
866 
867  std::set<std::string> unknown_synced_attributes_;
868  std::set<std::string> unknown_unsynced_attributes_;
869  std::set<std::string> unknown_synced_children_;
870  std::set<std::string> unknown_unsynced_children_;
871 
872  // a bit verbose, but it being a compile time error if a preference hasn't been added is nice
873  static constexpr std::array synced_attributes_{
874  prefs_list::player_joins_sound,
875  prefs_list::player_joins_notif,
876  prefs_list::player_joins_lobby,
877  prefs_list::player_leaves_sound,
878  prefs_list::player_leaves_notif,
879  prefs_list::player_leaves_lobby,
880  prefs_list::private_message_sound,
881  prefs_list::private_message_notif,
882  prefs_list::private_message_lobby,
883  prefs_list::friend_message_sound,
884  prefs_list::friend_message_notif,
885  prefs_list::friend_message_lobby,
886  prefs_list::public_message_sound,
887  prefs_list::public_message_notif,
888  prefs_list::public_message_lobby,
889  prefs_list::server_message_sound,
890  prefs_list::server_message_notif,
891  prefs_list::server_message_lobby,
892  prefs_list::ready_for_start_sound,
893  prefs_list::ready_for_start_notif,
894  prefs_list::ready_for_start_lobby,
895  prefs_list::game_has_begun_sound,
896  prefs_list::game_has_begun_notif,
897  prefs_list::game_has_begun_lobby,
898  prefs_list::turn_changed_sound,
899  prefs_list::turn_changed_notif,
900  prefs_list::turn_changed_lobby,
901  prefs_list::game_created_sound,
902  prefs_list::game_created_notif,
903  prefs_list::game_created_lobby,
904  prefs_list::_last_cache_cleaned_ver,
905  prefs_list::addon_manager_saved_order_direction,
906  prefs_list::addon_manager_saved_order_name,
907  prefs_list::alias,
908  prefs_list::allow_observers,
910  prefs_list::ally_sighted_interrupts,
911  prefs_list::auto_save_max,
912  prefs_list::blindfold_replay,
913  prefs_list::campaign_server,
914  prefs_list::chat_lines,
915  prefs_list::chat_timestamp,
916  prefs_list::confirm_end_turn,
917  prefs_list::custom_command,
918  prefs_list::delete_saves,
919  prefs_list::disable_auto_moves,
920  prefs_list::editor_auto_update_transitions,
921  prefs_list::editor_draw_hex_coordinates,
922  prefs_list::editor_draw_num_of_bitmaps,
923  prefs_list::editor_draw_terrain_codes,
924  prefs_list::enable_planning_mode_on_start,
925  prefs_list::encountered_terrain_list,
926  prefs_list::encountered_units,
928  prefs_list::fi_blocked_in_game,
929  prefs_list::fi_friends_in_game,
930  prefs_list::fi_invert,
931  prefs_list::fi_vacant_slots,
932  prefs_list::floating_labels,
933  prefs_list::grid,
934  prefs_list::hide_whiteboard,
935  prefs_list::host,
936  prefs_list::idle_anim,
937  prefs_list::idle_anim_rate,
939  prefs_list::lobby_whisper_friends_only,
940  prefs_list::locale,
941  prefs_list::login,
942  prefs_list::message_bell,
943  prefs_list::minimap_draw_terrain,
944  prefs_list::minimap_draw_units,
945  prefs_list::minimap_draw_villages,
946  prefs_list::minimap_movement_coding,
947  prefs_list::minimap_terrain_coding,
949  prefs_list::mp_countdown,
950  prefs_list::mp_countdown_action_bonus,
951  prefs_list::mp_countdown_init_time,
952  prefs_list::mp_countdown_reservoir_time,
953  prefs_list::mp_countdown_turn_bonus,
954  prefs_list::mp_fog,
955  prefs_list::mp_level_type,
956  prefs_list::mp_random_start_time,
957  prefs_list::mp_server_warning_disabled,
958  prefs_list::mp_shroud,
959  prefs_list::mp_turns,
960  prefs_list::mp_use_map_settings,
961  prefs_list::mp_village_gold,
962  prefs_list::mp_village_support,
963  prefs_list::mp_xp_modifier,
964  prefs_list::music,
967  prefs_list::remember_password,
968  prefs_list::save_replays,
969  prefs_list::scroll,
970  prefs_list::scroll_threshold,
976  prefs_list::show_side_colors,
979  prefs_list::shuffle_sides,
980  prefs_list::skip_ai_moves,
981  prefs_list::skip_mp_replay,
982  prefs_list::sound,
983  prefs_list::sample_rate,
984  prefs_list::stop_music_in_background,
985  prefs_list::turbo,
986  prefs_list::turbo_speed,
988  prefs_list::turn_dialog,
989  prefs_list::ui_sound,
990  prefs_list::unit_standing_animations,
992  prefs_list::ask_delete,
993  prefs_list::chat_message_aging,
994  prefs_list::color_cursors,
995  prefs_list::compress_saves,
996  prefs_list::confirm_load_save_from_different_version,
997  prefs_list::damage_prediction_allow_monte_carlo_simulation,
998  prefs_list::editor_max_recent_files,
999  prefs_list::keepalive_timeout,
1000  prefs_list::lobby_auto_open_whisper_windows,
1001  prefs_list::middle_click_scrolls,
1002  prefs_list::mouse_scrolling,
1003  prefs_list::scroll_to_action,
1004  prefs_list::scroll_when_mouse_outside,
1005  prefs_list::show_all_units_in_help,
1006  prefs_list::show_combat,
1007  prefs_list::show_deprecation,
1008  prefs_list::use_twelve_hour_clock_format,
1009  prefs_list::mp_era,
1010  prefs_list::mp_level,
1011  prefs_list::mp_modifications,
1012  prefs_list::selected_achievement_group,
1013  prefs_list::sp_modifications,
1014  prefs_list::animate_map,
1015  prefs_list::animate_water,
1016  };
1017  static constexpr std::array synced_children_{
1018  prefs_list::achievements,
1019  prefs_list::completed_campaigns,
1020  prefs_list::history,
1021  prefs_list::options,
1022  };
1023  static constexpr std::array unsynced_attributes_{
1024  prefs_list::auto_pixel_scale,
1025  prefs_list::core,
1026  prefs_list::dir_bookmarks,
1027  prefs_list::draw_delay,
1028  prefs_list::editor_chosen_addon,
1029  prefs_list::gui2_theme,
1030  prefs_list::mp_server_program_name,
1031  prefs_list::pixel_scale,
1032  prefs_list::sound_buffer_size,
1033  prefs_list::theme,
1035  prefs_list::vsync,
1036  prefs_list::xresolution,
1037  prefs_list::yresolution,
1038  prefs_list::font_scale,
1043  prefs_list::fullscreen,
1044  prefs_list::maximized,
1045  };
1046  static constexpr std::array unsynced_children_{
1047  prefs_list::editor_recent_files,
1048  };
1049  static_assert(synced_attributes_.size() + synced_children_.size() + unsynced_attributes_.size() + unsynced_children_.size() == prefs_list::values.size(), "attribute missing from lists of synced or unsynced preferences!");
1050 };
1051 
1052 //
1053 // might be overkill, but it does best limit the private functionality being exposed
1054 //
1055 
1057 {
1058  friend class preferences_dialog;
1059 
1060  static void set(const std::string& pref, bool value)
1061  {
1062  prefs::get().preferences_[pref] = value;
1063  }
1064  static void set(const std::string& pref, int value)
1065  {
1066  prefs::get().preferences_[pref] = value;
1067  }
1068  static void set(const std::string& pref, const std::string& value)
1069  {
1070  prefs::get().preferences_[pref] = value;
1071  }
1072 
1073  static bool get(const std::string& pref, bool def)
1074  {
1075  return prefs::get().preferences_[pref].to_bool(def);
1076  }
1077  static int get(const std::string& pref, int def)
1078  {
1079  return prefs::get().preferences_[pref].to_int(def);
1080  }
1081  static std::string get(const std::string& pref, const std::string& def)
1082  {
1083  return prefs::get().get(pref, def);
1084  }
1085 };
double t
Definition: astarsearch.cpp:63
Variant for storing WML attributes.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:159
void clear()
Definition: config.cpp:831
Game board class.
Definition: game_board.hpp:46
A class grating read only view to a vector of config objects, viewed as one config with all children ...
Encapsulates the map of the game.
Definition: map.hpp:172
std::string nick_
acquaintance's MP nick
void save(config &item)
Definition: preferences.hpp:94
acquaintance(const std::string &nick, const std::string &status, const std::string &notes)
Definition: preferences.hpp:83
std::string notes_
notes on the acquaintance
const std::string & get_status() const
Definition: preferences.hpp:91
const std::string & get_nick() const
Definition: preferences.hpp:90
std::string status_
status (e.g., "friend", "ignore")
const std::string & get_notes() const
Definition: preferences.hpp:92
acquaintance(const config &cfg)
Definition: preferences.hpp:76
bool player_joins_notif()
void set_lobby_joins(pref_constants::lobby_joins show)
bool player_joins_lobby()
std::string enemy_color()
bool allow_observers()
bool server_message_notif()
bool ready_for_start_sound()
config::attribute_value get_as_attribute(const std::string &key)
void set_show_ally_orb(bool show_orb)
void set_network_host(const std::string &host)
void set_friend_message_notif(bool val)
std::set< t_translation::terrain_code > & encountered_terrains()
const config & options()
void set_player_leaves_notif(bool val)
bool set_music(bool ison)
void set_friend_message_lobby(bool val)
void set_sound_volume(int vol)
int turns()
void set_remember_password(bool remember)
std::string language()
bool chat_timestamping()
bool show_ally_orb()
const std::map< std::string, preferences::acquaintance > & get_acquaintances()
optional_const_config get_alias()
bool friend_message_notif()
bool skip_ai_moves()
bool show_theme_dialog()
void set_turbo(bool ison)
void set_animate_water(bool value)
void set_show_disengaged_orb(bool show_orb)
bool game_has_begun_sound()
bool turn_changed_notif()
void set_player_joins_lobby(bool val)
void set_core_id(const std::string &root)
std::string get_system_username()
bool show_side_colors()
prefs(const prefs &&p)=delete
int mp_server_warning_disabled()
void set_fi_blocked_in_game(bool value)
bool show_status_on_ally_orb()
bool mp_modifications_initialized_
std::map< std::string, std::vector< std::string > > history_map_
void save_hotkeys()
std::string gui_theme()
int village_support()
void set_addon_manager_saved_order_direction(sort_order::type value)
void set_language(const std::string &s)
bool public_message_sound()
bool maximized()
void set_autosavemax(int value)
bool middle_click_scrolls()
void toggle_minimap_draw_units()
bool turn_bell()
void set_editor_draw_hex_coordinates(bool value)
void set_show_side_colors(bool value)
int countdown_init_time()
std::string addon_manager_saved_order_name()
std::set< std::string > & encountered_units()
bool editor_draw_hex_coordinates()
void add_alias(const std::string &alias, const std::string &command)
bool minimap_draw_villages()
void set_idle_anim(const bool ison)
void set_countdown_reservoir_time(int value)
double turbo_speed()
void set_turns(int value)
void write_preferences()
void clear_preferences()
int autosavemax()
std::vector< std::string > sp_modifications_
void clear_mp_alert_prefs()
void set_editor_draw_num_of_bitmaps(bool value)
unsigned int tile_size()
void set_village_gold(int value)
void set_chat_message_aging(const int aging)
bool enable_whiteboard_mode_on_start()
void toggle_minimap_draw_villages()
void set_ready_for_start_notif(bool val)
bool confirm_load_save_from_different_version()
std::string network_host()
void clear_countdown_init_time()
std::set< std::string > unknown_unsynced_attributes_
void set_draw_delay(int value)
void set_show_floating_labels(bool value)
bool set_ui_sound(bool ison)
bool damage_prediction_allow_monte_carlo_simulation()
bool idle_anim()
void set_mp_server_warning_disabled(int value)
bool show_unmoved_orb()
void set_login(const std::string &login)
static prefs & get()
bool skip_mp_replay()
const std::string get_ignored_delim()
bool ready_for_start_lobby()
std::map< std::string, preferences::acquaintance > acquaintances_
bool editor_draw_num_of_bitmaps()
bool interrupt_when_ally_sighted()
friend int impl_preferences_set(lua_State *L)
The __newindex metamethod.
static constexpr std::array unsynced_children_
bool game_created_notif()
bool game_has_begun_lobby()
bool show_floating_labels()
bool player_leaves_notif()
void set_turbo_speed(const double speed)
void enable_mouse_scroll(bool value)
bool ask_delete_saves()
bool fps_
bool game_created_lobby()
void set_countdown_action_bonus(int value)
void set_player_leaves_lobby(bool val)
int scroll_speed()
void set_whisper_friends_only(bool v)
bool message_private()
void encounter_recallable_units(const std::vector< team > &teams)
std::map< std::string, std::set< std::string > > completed_campaigns_
bool show_combat()
std::string selected_achievement_group()
bool blindfold_replay()
std::string theme()
void set_level_type(int value)
optional_const_config dir_bookmarks()
bool friend_message_sound()
void set_theme(const std::string &theme)
void set_ready_for_start_lobby(bool val)
int chat_message_aging()
void set_xp_modifier(int value)
void set_server_message_sound(bool val)
void set_user_servers_list(const std::vector< game_config::server_info > &value)
void toggle_minimap_draw_terrain()
preferences::secure_buffer build_key(const std::string &server, const std::string &login)
Fills a secure_buffer with 32 bytes of deterministically generated bytes, then overwrites it with the...
void set_auto_pixel_scale(bool choice)
std::vector< preferences::option > & get_advanced_preferences()
void set_delete_saves(bool value)
bool player_leaves_sound()
int countdown_action_bonus()
int level_type()
void set_chat_lines(int lines)
void set_stop_music_in_background(bool ison)
bool is_campaign_completed(const std::string &campaign_id)
void set_allied_color(const std::string &color_id)
bool get_scroll_when_mouse_outside(bool def)
void show_wesnothd_server_search()
bool green_confirm()
int bell_volume()
int mouse_scroll_threshold()
Gets the threshold for when to scroll.
bool show_moved_orb()
void set_editor_auto_update_transitions(int value)
bool is_ignored(const std::string &nick)
void set_turn_changed_sound(bool val)
bool save_replays()
std::string default_dir()
std::vector< std::string > mp_modifications_
bool hide_whiteboard()
bool achievement(const std::string &content_for, const std::string &id)
bool minimap_draw_units()
std::set< std::string > unknown_synced_attributes_
void set_enemy_color(const std::string &color_id)
void set_ask_delete_saves(bool value)
void set_player_joins_notif(bool val)
void save_credentials()
void set_password(const std::string &server, const std::string &login, const std::string &key)
void set_gui_theme(const std::string &s)
bool sub_achievement(const std::string &content_for, const std::string &id, const std::string &sub_id)
void clear_credentials()
bool delete_saves()
std::vector< preferences::login_info > credentials_
std::vector< std::string > do_read_editor_mru()
bool fog()
void set_game_has_begun_lobby(bool val)
void set_friend_message_sound(bool val)
bool scroll_to_action()
bool ellipses()
void encounter_recruitable_units(const std::vector< team > &teams)
std::string era()
bool parse_should_show_lobby_join(const std::string &sender, const std::string &message)
static bool preferences_save()
bool friend_message_lobby()
int progress_achievement(const std::string &content_for, const std::string &id, int limit=999999, int max_progress=999999, int amount=0)
Increments the achievement's current progress by amount if it hasn't already been completed.
sort_order::type addon_manager_saved_order_direction()
bool set_turn_bell(bool ison)
static constexpr std::array synced_attributes_
unsigned int sample_rate()
void set_show_status_on_ally_orb(bool show_orb)
static constexpr std::array synced_children_
void set_public_message_notif(bool val)
void set_private_message_notif(bool val)
void set_last_cache_cleared_version(const std::string &version)
void set_chat_timestamping(bool value)
void set_player_leaves_sound(bool val)
void set_game_has_begun_sound(bool val)
void set_options(const config &values)
void set_message_private(bool value)
bool mouse_scroll_enabled()
std::vector< game_config::server_info > user_servers_list()
optional_const_config get_child(const std::string &key)
void load_credentials()
std::string unmoved_color()
void set_music_volume(int vol)
void set_save_replays(bool value)
void set_countdown(bool value)
void load_advanced_prefs(const game_config_view &gc)
std::string editor_chosen_addon()
std::string allied_color()
bool minimap_draw_terrain()
bool public_message_lobby()
bool vsync()
void set_show_standing_animations(bool value)
void set_show_fps(bool value)
std::string custom_command()
void set_pixel_scale(const int scale)
std::size_t editor_mru_limit()
bool show_partial_orb()
void set_color_cursors(bool value)
void set_selected_achievement_group(const std::string &content_for)
int editor_auto_update_transitions()
void set_show_all_units_in_help(bool value)
int draw_delay()
std::vector< preferences::option > advanced_prefs_
void encounter_start_units(const unit_map &units)
void set_countdown_turn_bonus(int value)
pref_constants::lobby_joins get_lobby_joins()
bool auto_pixel_scale()
bool ready_for_start_notif()
bool minimap_terrain_coding()
void set_editor_draw_terrain_codes(bool value)
void set_player_joins_sound(bool val)
void set_fi_friends_in_game(bool value)
bool show_fps()
void load_hotkeys()
std::string random_faction_mode()
void encounter_map_terrain(const gamemap &map)
int font_scaling()
void set_disable_auto_moves(bool value)
void set_blindfold_replay(bool value)
void set_public_message_lobby(bool val)
bool fi_blocked_in_game()
void set_village_support(int value)
preferences::secure_buffer escape(const preferences::secure_buffer &text)
prefs & operator=(const prefs &&p)=delete
std::string moved_color()
bool confirm_no_moves()
bool minimap_movement_coding()
void set_font_scaling(int scale)
std::size_t sound_buffer_size()
bool use_color_cursors()
void set_game_created_notif(bool val)
void set_addon_manager_saved_order_name(const std::string &value)
bool yellow_confirm()
bool server_message_lobby()
config option_values_
void set_use_map_settings(bool value)
void set_show_partial_orb(bool show_orb)
void migrate_preferences(const std::string &prefs_dir)
bool grid()
bool show_disengaged_orb()
bool whisper_friends_only()
bool message_bell()
void set_server_message_notif(bool val)
void set_interrupt_when_ally_sighted(bool value)
void set_dir_bookmarks(const config &cfg)
bool message_private_on_
std::set< t_translation::terrain_code > encountered_terrains_set_
friend int impl_preferences_get(lua_State *L)
The __index metamethod.
bool set_sound(bool ison)
void set_fi_invert(bool value)
bool is_friend(const std::string &nick)
void set_achievement(const std::string &content_for, const std::string &id)
Marks the specified achievement as completed.
preferences::secure_buffer aes_decrypt(const preferences::secure_buffer &text, const preferences::secure_buffer &key)
Same as aes_encrypt(), except of course it takes encrypted data as an argument and returns decrypted ...
bool animate_map()
bool public_message_notif()
int village_gold()
config preferences_
bool private_message_lobby()
void toggle_minimap_movement_coding()
void clear_countdown_turn_bonus()
std::string login()
bool music_on()
void set_random_faction_mode(const std::string &value)
void set_turn_changed_notif(bool val)
void set_show_unmoved_orb(bool show_orb)
void set_idle_anim_rate(int rate)
bool server_message_sound()
bool show_all_units_in_help()
int font_scaled(int size)
void set_scroll_speed(const int scroll)
bool turn_dialog()
std::pair< preferences::acquaintance *, bool > add_acquaintance(const std::string &nick, const std::string &mode, const std::string &notes)
prefs(const prefs &p)=delete
void set_random_start_time(bool value)
bool ui_sound_on()
bool random_start_time()
bool options_initialized_
bool private_message_notif()
void set_allow_observers(bool value)
int music_volume()
bool disable_auto_moves()
void set_shroud(bool value)
bool game_created_sound()
int pixel_scale()
std::string partial_color()
int idle_anim_rate()
preferences::secure_buffer unescape(const preferences::secure_buffer &text)
void set_scroll_to_action(bool ison)
void set_resolution(const point &res)
static void disable_preferences_save()
void set_fullscreen(bool ison)
void set_campaign_server(const std::string &host)
void set_countdown_init_time(int value)
void set_unmoved_color(const std::string &color_id)
bool remove_acquaintance(const std::string &nick)
void clear_countdown_reservoir_time()
bool show_enemy_orb()
void set_ui_volume(int vol)
bool turbo()
void toggle_minimap_terrain_coding()
const std::vector< std::string > & modifications(bool mp=true)
void do_commit_editor_mru(const std::vector< std::string > &mru)
void set_game_has_begun_notif(bool val)
bool fi_invert()
compression::format save_compression_format()
std::vector< std::string > recent_files()
Retrieves the list of recently opened files.
void set_hide_whiteboard(bool value)
bool game_has_begun_notif()
std::set< std::string > encountered_units_set_
void set_bell_volume(int vol)
std::string get_mp_server_program_name()
prefs & operator=(const prefs &p)=delete
void set_ready_for_start_sound(bool val)
void set_public_message_sound(bool val)
void set_era(const std::string &value)
bool private_message_sound()
void set_enable_whiteboard_mode_on_start(bool value)
bool countdown()
void set_custom_command(const std::string &command)
std::string level()
void set_partial_color(const std::string &color_id)
bool fi_friends_in_game()
bool shroud()
void set_child(const std::string &key, const config &val)
static constexpr std::array unsynced_attributes_
void set_animate_map(bool value)
std::set< std::string > all_attributes()
void set_game_created_sound(bool val)
void set_skip_ai_moves(bool value)
int keepalive_timeout()
void set_mp_server_program_name(const std::string &)
bool animate_water()
void set_fi_vacant_slots(bool value)
bool remember_password()
int ui_volume()
int chat_lines()
void add_recent_files_entry(const std::string &path)
Adds an entry to the recent files list.
void set_moved_color(const std::string &color_id)
std::string get_chat_timestamp(const std::time_t &t)
void set_show_enemy_orb(bool show_orb)
void set_private_message_lobby(bool val)
point resolution()
void save_sample_rate(const unsigned int rate)
bool use_twelve_hour_clock_format()
void set_editor_chosen_addon(const std::string &addon_id)
static bool no_preferences_save
std::string last_cache_cleared_version()
bool editor_draw_terrain_codes()
void set_tile_size(const unsigned int size)
void set_grid(bool ison)
int sound_volume()
void set_modifications(const std::vector< std::string > &value, bool mp=true)
void set_turn_changed_lobby(bool val)
void set_game_created_lobby(bool val)
void set_sub_achievement(const std::string &content_for, const std::string &id, const std::string &sub_id)
Marks the specified sub-achievement as completed.
void set_shuffle_sides(bool value)
int countdown_reservoir_time()
std::set< std::string > unknown_unsynced_children_
bool player_joins_sound()
const std::vector< game_config::server_info > & builtin_servers_list()
bool player_leaves_lobby()
void set_ellipses(bool ison)
bool turn_changed_lobby()
void reload_preferences()
std::string campaign_server()
std::set< std::string > unknown_synced_children_
bool fullscreen()
void set_skip_mp_replay(bool value)
bool sound_on()
void set_turn_dialog(bool ison)
std::string core_id()
void set_show_moved_orb(bool show_orb)
int countdown_turn_bonus()
void set_server_message_lobby(bool val)
void set_damage_prediction_allow_monte_carlo_simulation(bool value)
bool shuffle_sides()
void add_completed_campaign(const std::string &campaign_id, const std::string &difficulty_level)
void set_level(const std::string &value)
void set_fog(bool value)
void clear_hotkeys()
void set_maximized(bool ison)
void save_sound_buffer_size(const std::size_t size)
int xp_modifier()
bool use_map_settings()
void encounter_all_content(const game_board &gb)
std::string password(const std::string &server, const std::string &login)
bool sp_modifications_initialized_
void set_vsync(bool ison)
std::vector< std::string > * get_history(const std::string &id)
Returns a pointer to the history vector associated with given id making a new one if it doesn't exist...
preferences::secure_buffer aes_encrypt(const preferences::secure_buffer &text, const preferences::secure_buffer &key)
Encrypts the value of text using key and a hard coded IV using AES.
void set_private_message_sound(bool val)
bool auto_open_whisper_windows()
void load_preferences()
std::map< std::string, std::string > get_acquaintances_nice(const std::string &filter)
bool get_show_deprecation(bool def)
bool show_standing_animations()
void clear_countdown_action_bonus()
bool fi_vacant_slots()
bool turn_changed_sound()
bool stop_music_in_background()
Definition: theme.hpp:44
Container associating units to locations.
Definition: map.hpp:98
Declarations for File-IO.
Standard logging facilities (interface).
void fill(const SDL_Rect &rect, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
Fill an area with the given colour.
Definition: draw.cpp:50
std::string partial_orb_color
std::string moved_orb_color
std::string unmoved_orb_color
std::string ally_orb_color
std::string enemy_orb_color
std::string turn_bell
std::string path
Definition: filesystem.cpp:89
bool show_status_on_ally_orb
bool show_moved_orb
unsigned int tile_size
Definition: game_config.cpp:52
bool show_ally_orb
bool show_disengaged_orb
bool show_partial_orb
bool show_enemy_orb
bool show_unmoved_orb
void show(const std::string &window_id, const t_string &message, const point &mouse, const SDL_Rect &source_rect)
Shows a tip.
Definition: tooltip.cpp:65
static int bell_volume()
static int music_volume()
static int ui_volume()
static int sound_volume()
std::pair< std::string, unsigned > item
Definition: help_impl.hpp:410
Main entry points of multiplayer mode.
Definition: lobby_data.cpp:49
const int min_window_height
Definition: preferences.hpp:36
const int TRANSITION_UPDATE_ON
Definition: preferences.hpp:51
const int max_pixel_scale
Definition: preferences.hpp:48
const std::string EMPTY_LOGIN
Definition: preferences.hpp:56
const int min_pixel_scale
Definition: preferences.hpp:47
const std::string default_addons_server
Definition: preferences.hpp:60
const int def_window_width
Definition: preferences.hpp:38
const int min_font_scaling
Definition: preferences.hpp:44
const int TRANSITION_UPDATE_COUNT
Definition: preferences.hpp:53
const int min_window_width
Definition: preferences.hpp:35
const int TRANSITION_UPDATE_OFF
Definition: preferences.hpp:50
const int max_font_scaling
Definition: preferences.hpp:45
const int max_window_height
Definition: preferences.hpp:42
const int max_window_width
Definition: preferences.hpp:41
const int def_window_height
Definition: preferences.hpp:39
const int INFINITE_AUTO_SAVES
Definition: preferences.hpp:58
const unsigned char CREDENTIAL_SEPARATOR
Definition: preferences.hpp:55
const int TRANSITION_UPDATE_PARTIAL
Definition: preferences.hpp:52
Modify, read and display user preferences.
Definition: preferences.hpp:68
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
Definition: unicode.cpp:85
void scale(size_t factor, const uint32_t *src, uint32_t *trg, int srcWidth, int srcHeight, const ScalerCfg &cfg=ScalerCfg(), int yFirst=0, int yLast=std::numeric_limits< int >::max())
Definition: xbrz.cpp:1189
string_enums::enum_base< random_faction_mode_defines > random_faction_mode
Holds a 2D point.
Definition: point.hpp:25
login_info(const std::string &username, const std::string &server, const secure_buffer &key)
std::size_t size() const
login_info(const std::string &username, const std::string &server)
t_string description
Displayed description.
avd_type type
The preference type.
option(const config &pref)
t_string name
Displayed name.
std::string field
The actual field saved in the prefs file and by which this preference may be accessed.
config cfg
The full config, including type-specific options.
static void set(const std::string &pref, int value)
static void set(const std::string &pref, const std::string &value)
static int get(const std::string &pref, int def)
static std::string get(const std::string &pref, const std::string &def)
static bool get(const std::string &pref, bool def)
static void set(const std::string &pref, bool value)
mock_party p
static map_location::DIRECTION s