79 nick_ = cfg[
"nick"].str();
81 notes_ = cfg[
"notes"].str();
84 acquaintance(
const std::string& nick,
const std::string& status,
const std::string& notes)
117 : vector<unsigned char>(std::forward<T>(args)...)
145 ,
name(pref[
"name"].t_str())
147 ,
field(pref[
"field"].str())
150 const std::string p_type =
cfg[
"type"];
152 if(p_type ==
"boolean") {
154 }
else if(p_type ==
"int") {
156 }
else if(p_type ==
"combo") {
158 }
else if(p_type ==
"custom") {
161 throw std::invalid_argument(
"Unknown type '" + p_type +
"' for advanced preference " +
name);
184 #define PREF_GETTER_SETTER(pref, type, def) \
185 void set_##pref(const type& value) { \
186 preferences_[prefs_list::pref] = value; \
188 type pref() const { \
189 return preferences_[prefs_list::pref].to(def); \
201 static prefs prefs_manager;
202 return prefs_manager;
248 std::vector<std::string>*
get_history(
const std::string&
id);
298 void add_alias(
const std::string& alias,
const std::string& command);
352 std::pair<preferences::acquaintance*, bool>
add_acquaintance(
const std::string& nick,
const std::string& mode,
const std::string& notes);
407 std::string
password(
const std::string& server,
const std::string&
login);
408 void set_password(
const std::string& server,
const std::string&
login,
const std::string& key);
444 bool achievement(
const std::string& content_for,
const std::string&
id);
451 void set_achievement(
const std::string& content_for,
const std::string&
id);
467 int progress_achievement(
const std::string& content_for,
const std::string&
id,
int limit = 999999,
int max_progress = 999999,
int amount = 0);
475 bool sub_achievement(
const std::string& content_for,
const std::string&
id,
const std::string& sub_id);
486 void set_sub_achievement(
const std::string& content_for,
const std::string&
id,
const std::string& sub_id);
595 #undef PREF_GETTER_SETTER
633 std::string
get(
const std::string& key,
const std::string& def);
672 prefs_list::player_joins_sound,
673 prefs_list::player_joins_notif,
674 prefs_list::player_joins_lobby,
675 prefs_list::player_leaves_sound,
676 prefs_list::player_leaves_notif,
677 prefs_list::player_leaves_lobby,
678 prefs_list::private_message_sound,
679 prefs_list::private_message_notif,
680 prefs_list::private_message_lobby,
681 prefs_list::friend_message_sound,
682 prefs_list::friend_message_notif,
683 prefs_list::friend_message_lobby,
684 prefs_list::public_message_sound,
685 prefs_list::public_message_notif,
686 prefs_list::public_message_lobby,
687 prefs_list::server_message_sound,
688 prefs_list::server_message_notif,
689 prefs_list::server_message_lobby,
690 prefs_list::ready_for_start_sound,
691 prefs_list::ready_for_start_notif,
692 prefs_list::ready_for_start_lobby,
693 prefs_list::game_has_begun_sound,
694 prefs_list::game_has_begun_notif,
695 prefs_list::game_has_begun_lobby,
696 prefs_list::turn_changed_sound,
697 prefs_list::turn_changed_notif,
698 prefs_list::turn_changed_lobby,
699 prefs_list::game_created_sound,
700 prefs_list::game_created_notif,
701 prefs_list::game_created_lobby,
702 prefs_list::_last_cache_cleaned_ver,
703 prefs_list::addon_manager_saved_order_direction,
704 prefs_list::addon_manager_saved_order_name,
706 prefs_list::allow_observers,
708 prefs_list::ally_sighted_interrupts,
709 prefs_list::auto_save_max,
710 prefs_list::blindfold_replay,
711 prefs_list::campaign_server,
712 prefs_list::chat_lines,
713 prefs_list::chat_timestamp,
714 prefs_list::confirm_end_turn,
715 prefs_list::custom_command,
716 prefs_list::delete_saves,
717 prefs_list::disable_auto_moves,
718 prefs_list::editor_auto_update_transitions,
719 prefs_list::editor_draw_hex_coordinates,
720 prefs_list::editor_draw_num_of_bitmaps,
721 prefs_list::editor_draw_terrain_codes,
722 prefs_list::enable_planning_mode_on_start,
723 prefs_list::encountered_terrain_list,
724 prefs_list::encountered_units,
726 prefs_list::fi_blocked_in_game,
727 prefs_list::fi_friends_in_game,
728 prefs_list::fi_invert,
729 prefs_list::fi_vacant_slots,
730 prefs_list::floating_labels,
732 prefs_list::hide_whiteboard,
734 prefs_list::idle_anim,
735 prefs_list::idle_anim_rate,
737 prefs_list::lobby_whisper_friends_only,
740 prefs_list::message_bell,
741 prefs_list::minimap_draw_terrain,
742 prefs_list::minimap_draw_units,
743 prefs_list::minimap_draw_villages,
744 prefs_list::minimap_movement_coding,
745 prefs_list::minimap_terrain_coding,
747 prefs_list::mp_countdown,
748 prefs_list::mp_countdown_action_bonus,
749 prefs_list::mp_countdown_init_time,
750 prefs_list::mp_countdown_reservoir_time,
751 prefs_list::mp_countdown_turn_bonus,
753 prefs_list::mp_level_type,
754 prefs_list::mp_random_start_time,
755 prefs_list::mp_server_warning_disabled,
756 prefs_list::mp_shroud,
757 prefs_list::mp_turns,
758 prefs_list::mp_use_map_settings,
759 prefs_list::mp_village_gold,
760 prefs_list::mp_village_support,
761 prefs_list::mp_xp_modifier,
765 prefs_list::remember_password,
766 prefs_list::save_replays,
768 prefs_list::scroll_threshold,
774 prefs_list::show_side_colors,
777 prefs_list::shuffle_sides,
778 prefs_list::skip_ai_moves,
779 prefs_list::skip_mp_replay,
781 prefs_list::sample_rate,
782 prefs_list::stop_music_in_background,
784 prefs_list::turbo_speed,
786 prefs_list::turn_dialog,
787 prefs_list::ui_sound,
788 prefs_list::unit_standing_animations,
790 prefs_list::ask_delete,
791 prefs_list::chat_message_aging,
792 prefs_list::color_cursors,
793 prefs_list::compress_saves,
794 prefs_list::confirm_load_save_from_different_version,
795 prefs_list::damage_prediction_allow_monte_carlo_simulation,
796 prefs_list::editor_max_recent_files,
797 prefs_list::keepalive_timeout,
798 prefs_list::lobby_auto_open_whisper_windows,
799 prefs_list::middle_click_scrolls,
800 prefs_list::mouse_scrolling,
801 prefs_list::scroll_to_action,
802 prefs_list::scroll_when_mouse_outside,
803 prefs_list::show_all_units_in_help,
804 prefs_list::show_combat,
805 prefs_list::show_deprecation,
806 prefs_list::use_twelve_hour_clock_format,
808 prefs_list::mp_level,
809 prefs_list::mp_modifications,
810 prefs_list::selected_achievement_group,
811 prefs_list::sp_modifications,
812 prefs_list::animate_map,
813 prefs_list::animate_water,
816 prefs_list::acquaintance,
817 prefs_list::achievements,
818 prefs_list::completed_campaigns,
824 prefs_list::auto_pixel_scale,
826 prefs_list::refresh_rate,
827 prefs_list::editor_chosen_addon,
828 prefs_list::gui2_theme,
829 prefs_list::mp_server_program_name,
830 prefs_list::pixel_scale,
831 prefs_list::sound_buffer_size,
835 prefs_list::xresolution,
836 prefs_list::yresolution,
837 prefs_list::font_scale,
842 prefs_list::fullscreen,
843 prefs_list::maximized,
846 prefs_list::editor_recent_files,
847 prefs_list::dir_bookmarks,
860 static void set(
const std::string& pref,
bool value)
864 static void set(
const std::string& pref,
int value)
868 static void set(
const std::string& pref,
const std::string& value)
873 static bool get(
const std::string& pref,
bool def)
877 static int get(
const std::string& pref,
int def)
881 static std::string
get(
const std::string& pref,
const std::string& def)
Variant for storing WML attributes.
A config object defines a single node in a WML file, with access to child nodes.
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.
std::string nick_
acquaintance's MP nick
acquaintance(const std::string &nick, const std::string &status, const std::string ¬es)
std::string notes_
notes on the acquaintance
const std::string & get_status() const
const std::string & get_nick() const
std::string status_
status (e.g., "friend", "ignore")
const std::string & get_notes() const
acquaintance(const config &cfg)
secure_buffer(T &&... args)
void set_lobby_joins(pref_constants::lobby_joins show)
std::string enemy_color()
config::attribute_value get_as_attribute(const std::string &key)
void set_network_host(const std::string &host)
std::set< t_translation::terrain_code > & encountered_terrains()
bool set_music(bool ison)
void set_sound_volume(int vol)
void set_remember_password(bool remember)
const std::map< std::string, preferences::acquaintance > & get_acquaintances()
optional_const_config get_alias()
void set_turbo(bool ison)
std::string get_system_username()
prefs(const prefs &&p)=delete
bool mp_modifications_initialized_
std::map< std::string, std::vector< std::string > > history_map_
void set_addon_manager_saved_order_direction(sort_order::type value)
std::chrono::seconds countdown_turn_bonus()
bool middle_click_scrolls()
void set_countdown_reservoir_time(const std::chrono::seconds &value)
std::set< std::string > & encountered_units()
void add_alias(const std::string &alias, const std::string &command)
std::vector< std::string > sp_modifications_
void clear_mp_alert_prefs()
The most recently selected add-on id from the editor.
void set_village_gold(int value)
bool confirm_load_save_from_different_version()
std::string network_host()
void clear_countdown_init_time()
std::set< std::string > unknown_unsynced_attributes_
bool set_ui_sound(bool ison)
std::chrono::minutes chat_message_aging()
void set_login(const std::string &login)
const std::string get_ignored_delim()
std::map< std::string, preferences::acquaintance > acquaintances_
friend int impl_preferences_set(lua_State *L)
The __newindex metamethod.
static constexpr std::array unsynced_children_
void encounter_recallable_units(const std::vector< team > &teams)
std::map< std::string, std::set< std::string > > completed_campaigns_
optional_const_config dir_bookmarks()
void set_theme(const std::string &theme)
void set_xp_modifier(int value)
void set_user_servers_list(const std::vector< game_config::server_info > &value)
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...
std::vector< preferences::option > & get_advanced_preferences()
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()
int mouse_scroll_threshold()
Gets the threshold for when to scroll.
bool is_ignored(const std::string &nick)
std::vector< std::string > mp_modifications_
bool achievement(const std::string &content_for, const std::string &id)
std::set< std::string > unknown_synced_attributes_
void set_enemy_color(const std::string &color_id)
std::chrono::seconds countdown_init_time()
void set_password(const std::string &server, const std::string &login, const std::string &key)
bool sub_achievement(const std::string &content_for, const std::string &id, const std::string &sub_id)
std::vector< preferences::login_info > credentials_
std::vector< std::string > do_read_editor_mru()
void encounter_recruitable_units(const std::vector< team > &teams)
bool parse_should_show_lobby_join(const std::string &sender, const std::string &message)
static bool preferences_save()
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_countdown_turn_bonus(const std::chrono::seconds &value)
static constexpr std::array synced_children_
void set_options(const config &values)
void set_message_private(bool value)
std::vector< game_config::server_info > user_servers_list()
optional_const_config get_child(const std::string &key)
std::string unmoved_color()
void set_music_volume(int vol)
void load_advanced_prefs(const game_config_view &gc)
std::string allied_color()
void set_show_standing_animations(bool value)
void set_show_fps(bool value)
void set_pixel_scale(const int scale)
std::size_t editor_mru_limit()
void set_color_cursors(bool value)
std::vector< preferences::option > advanced_prefs_
void encounter_start_units(const unit_map &units)
pref_constants::lobby_joins get_lobby_joins()
void set_chat_message_aging(const std::chrono::minutes &value)
void encounter_map_terrain(const gamemap &map)
void set_village_support(int value)
preferences::secure_buffer escape(const preferences::secure_buffer &text)
prefs & operator=(const prefs &&p)=delete
std::chrono::seconds countdown_action_bonus()
std::string moved_color()
void set_font_scaling(int scale)
std::size_t sound_buffer_size()
void migrate_preferences(const std::string &prefs_dir)
void set_dir_bookmarks(const config &cfg)
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)
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 ...
void clear_countdown_turn_bonus()
int font_scaled(int size)
void set_scroll_speed(const int scroll)
std::pair< preferences::acquaintance *, bool > add_acquaintance(const std::string &nick, const std::string &mode, const std::string ¬es)
prefs(const prefs &p)=delete
bool options_initialized_
std::string partial_color()
preferences::secure_buffer unescape(const preferences::secure_buffer &text)
void set_resolution(const point &res)
static void disable_preferences_save()
void set_campaign_server(const std::string &host)
void set_unmoved_color(const std::string &color_id)
bool remove_acquaintance(const std::string &nick)
void clear_countdown_reservoir_time()
void set_ui_volume(int vol)
const std::vector< std::string > & modifications(bool mp=true)
void do_commit_editor_mru(const std::vector< std::string > &mru)
std::chrono::seconds countdown_reservoir_time()
compression::format save_compression_format()
std::vector< std::string > recent_files()
Retrieves the list of recently opened files.
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_partial_color(const std::string &color_id)
void set_child(const std::string &key, const config &val)
static constexpr std::array unsynced_attributes_
std::set< std::string > all_attributes()
void set_mp_server_program_name(const std::string &)
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 save_sample_rate(const unsigned int rate)
bool use_twelve_hour_clock_format()
static bool no_preferences_save
void set_modifications(const std::vector< std::string > &value, bool mp=true)
void set_countdown_init_time(const std::chrono::seconds &value)
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.
std::set< std::string > unknown_unsynced_children_
const std::vector< game_config::server_info > & builtin_servers_list()
void reload_preferences()
std::string campaign_server()
std::set< std::string > unknown_synced_children_
void add_completed_campaign(const std::string &campaign_id, const std::string &difficulty_level)
void save_sound_buffer_size(const std::size_t size)
void encounter_all_content(const game_board &gb)
std::string password(const std::string &server, const std::string &login)
bool sp_modifications_initialized_
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_countdown_action_bonus(const std::chrono::seconds &value)
bool auto_open_whisper_windows()
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()
Container associating units to locations.
Definitions for the interface to Wesnoth Markup Language (WML).
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.
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
bool show_status_on_ally_orb
void show(const std::string &window_id, const t_string &message, const point &mouse, const SDL_Rect &source_rect)
Shows a tip.
static int music_volume()
static int sound_volume()
Main entry points of multiplayer mode.
const int min_window_height
const int TRANSITION_UPDATE_ON
const int max_pixel_scale
const std::string EMPTY_LOGIN
const int min_pixel_scale
const std::string default_addons_server
const int def_window_width
const int min_font_scaling
const int TRANSITION_UPDATE_COUNT
const int min_window_width
const int TRANSITION_UPDATE_OFF
const int max_font_scaling
const int max_window_height
const int max_window_width
const int def_window_height
const int INFINITE_AUTO_SAVES
const unsigned char CREDENTIAL_SEPARATOR
const int TRANSITION_UPDATE_PARTIAL
Modify, read and display user preferences.
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
void scale(size_t factor, const uint32_t *src, uint32_t *trg, int srcWidth, int srcHeight, ColorFormat colFmt, const ScalerCfg &cfg=ScalerCfg(), int yFirst=0, int yLast=std::numeric_limits< int >::max())
#define PREF_GETTER_SETTER(pref, type, def)
string_enums::enum_base< random_faction_mode_defines > random_faction_mode
login_info(const std::string &username, const std::string &server, const secure_buffer &key)
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)
friend class preferences_dialog
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)
The base template for associating string values with enum values.