macroify some preferences code

This commit is contained in:
pentarctagon 2024-07-30 18:28:22 -05:00 committed by Pentarctagon
parent da426144a6
commit 9821e2037b
27 changed files with 530 additions and 1728 deletions

View file

@ -1363,7 +1363,7 @@ std::size_t move_unit_and_record(const std::vector<map_location> &steps,
resources::gameboard->units().find(steps.front())->side() - 1];
continued_move |= !current_team.fog_or_shroud();
}
const bool skip_ally_sighted = !prefs::get().interrupt_when_ally_sighted();
const bool skip_ally_sighted = !prefs::get().ally_sighted_interrupts();
// Evaluate this move.
unit_mover mover(steps, move_spectator, continued_move, skip_ally_sighted);

View file

@ -141,6 +141,12 @@ public:
std::string str(const std::string& fallback = "") const;
t_string t_str() const;
bool to(const bool def) const { return to_bool(def); }
int to(int def) const { return to_int(def); }
unsigned to(unsigned def) const { return to_unsigned(def); }
double to(double def) const { return to_double(def); }
std::string to(const std::string& def) const { return str(def); }
// Implicit conversions:
operator int() const { return to_int(); }
operator std::string() const { return str(); }

View file

@ -304,7 +304,7 @@ bool controller_base::handle_scroll(int mousex, int mousey, int mouse_flags)
int scroll_speed = prefs::get().scroll_speed();
double dx = 0.0, dy = 0.0;
int scroll_threshold = prefs::get().mouse_scroll_enabled()
int scroll_threshold = prefs::get().mouse_scrolling()
? prefs::get().mouse_scroll_threshold()
: 0;

View file

@ -73,7 +73,7 @@ void countdown_clock::maybe_play_sound()
{
if(!playing_sound_ && team_.countdown_time() < WARNTIME )
{
if(prefs::get().turn_bell() || prefs::get().sound_on() || prefs::get().ui_sound_on())
if(prefs::get().turn_bell() || prefs::get().sound() || prefs::get().ui_sound_on())
{
const int loop_ticks = team_.countdown_time();
const int fadein_ticks = (loop_ticks > WARNTIME / 2) ? loop_ticks - WARNTIME / 2 : 0;

View file

@ -78,7 +78,7 @@ config game_classification::to_config() const
cfg["difficulty"] = difficulty;
cfg["random_mode"] = random_mode;
cfg["oos_debug"] = oos_debug;
cfg["core"] = prefs::get().core_id();
cfg["core"] = prefs::get().core();
return cfg;
}

View file

@ -75,15 +75,15 @@ game_config_manager::game_config_manager(const commandline_options& cmdline_opts
}
// Clean the cache of any old Wesnoth version's cache data
if(const std::string last_cleaned = prefs::get().last_cache_cleared_version(); !last_cleaned.empty()) {
if(const std::string last_cleaned = prefs::get()._last_cache_cleaned_ver(); !last_cleaned.empty()) {
if(version_info{last_cleaned} < game_config::wesnoth_version) {
if(cache_.clean_cache()) {
prefs::get().set_last_cache_cleared_version(game_config::wesnoth_version.str());
prefs::get().set__last_cache_cleaned_ver(game_config::wesnoth_version.str());
}
}
} else {
// If the preference wasn't set, set it, else the cleaning will never happen :P
prefs::get().set_last_cache_cleared_version(game_config::wesnoth_version.str());
prefs::get().set__last_cache_cleaned_ver(game_config::wesnoth_version.str());
}
}
@ -274,7 +274,7 @@ void game_config_manager::load_game_config(bool reload_everything, const game_cl
if(id == "default" && !current_core_valid) {
wml_tree_root = path;
}
if(id == prefs::get().core_id()) {
if(id == prefs::get().core()) {
current_core_valid = true;
wml_tree_root = path;
}
@ -286,11 +286,11 @@ void game_config_manager::load_game_config(bool reload_everything, const game_cl
events::call_in_main_thread([&]() {
gui2::dialogs::wml_error::display(
_("Error loading core data."),
_("Core ID: ") + prefs::get().core_id()
_("Core ID: ") + prefs::get().core()
+ '\n' + _("Error loading the core with named id.")
+ '\n' + _("Falling back to the default core."));
});
prefs::get().set_core_id("default");
prefs::get().set_core("default");
}
// check if we have a valid default core which should always be the case.
@ -364,13 +364,13 @@ void game_config_manager::load_game_config(bool reload_everything, const game_cl
e.message);
});
load_game_config(reload_everything, classification, scenario_id);
} else if(prefs::get().core_id() != "default") {
} else if(prefs::get().core() != "default") {
events::call_in_main_thread([&]() {
gui2::dialogs::wml_error::display(
_("Error loading custom game configuration files. The game will fallback to the default core files."),
e.message);
});
prefs::get().set_core_id("default");
prefs::get().set_core("default");
game_config::no_addons = false;
load_game_config(reload_everything, classification, scenario_id);
} else {
@ -534,7 +534,7 @@ void game_config_manager::load_addons_cfg()
// Skip add-ons not matching our current core. Cores themselves should be selectable
// at all times, so they aren't considered here.
if(!metadata.empty() && metadata["type"] != "core" && using_core != prefs::get().core_id()) {
if(!metadata.empty() && metadata["type"] != "core" && using_core != prefs::get().core()) {
continue;
}

View file

@ -587,7 +587,7 @@ void game_display::set_route(const pathfind::marked_route *route)
void game_display::float_label(const map_location& loc, const std::string& text, const color_t& color)
{
if(prefs::get().show_floating_labels() == false || fogged(loc)) {
if(prefs::get().floating_labels() == false || fogged(loc)) {
return;
}

View file

@ -63,7 +63,7 @@ std::string configure_engine::game_name_default()
int configure_engine::num_turns_default() const
{
return use_map_settings() ? settings::get_turns(initial_cfg()["turns"]) : prefs::get().turns();
return use_map_settings() ? settings::get_turns(initial_cfg()["turns"]) : prefs::get().mp_turns();
}
int configure_engine::village_gold_default() const
@ -109,31 +109,31 @@ int configure_engine::mp_countdown_action_bonus_default() const
bool configure_engine::mp_countdown_default() const
{
return prefs::get().countdown();
return prefs::get().mp_countdown();
}
bool configure_engine::use_map_settings_default() const
{
return force_lock_settings() || prefs::get().use_map_settings();
return force_lock_settings() || prefs::get().mp_use_map_settings();
}
bool configure_engine::random_start_time_default() const
{
return use_map_settings()
? initial_cfg()["random_start_time"].to_bool(false)
: prefs::get().random_start_time();
: prefs::get().mp_random_start_time();
}
bool configure_engine::fog_game_default() const
{
return use_map_settings()
? initial_cfg()["mp_fog"].to_bool(state_.classification().is_normal_mp_game())
: prefs::get().fog();
: prefs::get().mp_fog();
}
bool configure_engine::shroud_game_default() const
{
return use_map_settings() ? initial_cfg()["mp_shroud"].to_bool(false) : prefs::get().shroud();
return use_map_settings() ? initial_cfg()["mp_shroud"].to_bool(false) : prefs::get().mp_shroud();
}
bool configure_engine::allow_observers_default() const

View file

@ -128,7 +128,7 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts)
}
if(cmdline_opts_.core_id) {
prefs::get().set_core_id(*cmdline_opts_.core_id);
prefs::get().set_core(*cmdline_opts_.core_id);
}
if(cmdline_opts_.campaign) {
jump_to_campaign_.jump = true;
@ -259,7 +259,7 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts)
}
// disable sound in nosound mode, or when sound engine failed to initialize
if(no_sound || ((prefs::get().sound_on() || prefs::get().music_on() ||
if(no_sound || ((prefs::get().sound() || prefs::get().music_on() ||
prefs::get().turn_bell() || prefs::get().ui_sound_on()) &&
!sound::init_sound())) {
prefs::get().set_sound(false);

View file

@ -29,7 +29,7 @@ REGISTER_DIALOG(game_delete)
*/
static bool get_dont_ask_again()
{
return !prefs::get().ask_delete_saves();
return !prefs::get().ask_delete();
}
/**
@ -39,7 +39,7 @@ static bool get_dont_ask_again()
*/
static void set_dont_ask_again(const bool ask_again)
{
prefs::get().set_ask_delete_saves(!ask_again);
prefs::get().set_ask_delete(!ask_again);
}
game_delete::game_delete()

View file

@ -492,7 +492,7 @@ void game_load::delete_button_callback()
if(index < games_.size()) {
// See if we should ask the user for deletion confirmation
if(prefs::get().ask_delete_saves()) {
if(prefs::get().ask_delete()) {
if(!gui2::dialogs::game_delete::execute()) {
return;
}

View file

@ -128,7 +128,7 @@ void language_selection::post_show(window& window)
assert(res != -1);
::set_language(langs_[res]);
prefs::get().set_language(langs_[res].localename);
prefs::get().set_locale(langs_[res].localename);
}
}

View file

@ -66,21 +66,21 @@ mp_create_game::mp_create_game(saved_game& state, bool local_mode)
, selected_game_index_(-1)
, selected_rfm_index_(-1)
, use_map_settings_(register_bool( "use_map_settings", true,
[]() {return prefs::get().use_map_settings();},
[](bool v) {prefs::get().set_use_map_settings(v);},
[]() {return prefs::get().mp_use_map_settings();},
[](bool v) {prefs::get().set_mp_use_map_settings(v);},
std::bind(&mp_create_game::update_map_settings, this)))
, fog_(register_bool("fog", true,
[]() {return prefs::get().fog();},
[](bool v) {prefs::get().set_fog(v);}))
[]() {return prefs::get().mp_fog();},
[](bool v) {prefs::get().set_mp_fog(v);}))
, shroud_(register_bool("shroud", true,
[]() {return prefs::get().shroud();},
[](bool v) {prefs::get().set_shroud(v);}))
[]() {return prefs::get().mp_shroud();},
[](bool v) {prefs::get().set_mp_shroud(v);}))
, start_time_(register_bool("random_start_time", true,
[]() {return prefs::get().random_start_time();},
[](bool v) {prefs::get().set_random_start_time(v);}))
[]() {return prefs::get().mp_random_start_time();},
[](bool v) {prefs::get().set_mp_random_start_time(v);}))
, time_limit_(register_bool("time_limit", true,
[]() {return prefs::get().countdown();},
[](bool v) {prefs::get().set_countdown(v);},
[]() {return prefs::get().mp_countdown();},
[](bool v) {prefs::get().set_mp_countdown(v);},
std::bind(&mp_create_game::update_map_settings, this)))
, shuffle_sides_(register_bool("shuffle_sides", true,
[]() {return prefs::get().shuffle_sides();},
@ -91,8 +91,8 @@ mp_create_game::mp_create_game(saved_game& state, bool local_mode)
, strict_sync_(register_bool("strict_sync", true))
, private_replay_(register_bool("private_replay", true))
, turns_(register_integer("turn_count", true,
[]() {return prefs::get().turns();},
[](int v) {prefs::get().set_turns(v);}))
[]() {return prefs::get().mp_turns();},
[](int v) {prefs::get().set_mp_turns(v);}))
, gold_(register_integer("village_gold", true,
[]() {return prefs::get().village_gold();},
[](int v) {prefs::get().set_village_gold(v);}))
@ -199,7 +199,7 @@ void mp_create_game::pre_show(window& win)
// Helper to make sure the initially selected level type is valid
auto get_initial_type_index = [this]()->int {
const auto index = std::find_if(level_types_.begin(), level_types_.end(), [](level_type_info& info) {
return info.first == *level_type::get_enum(prefs::get().level_type());
return info.first == *level_type::get_enum(prefs::get().mp_level_type());
});
if(index != level_types_.end()) {
@ -266,7 +266,7 @@ void mp_create_game::pre_show(window& win)
connect_signal_notify_modified(*eras_menu_button_,
std::bind(&mp_create_game::on_era_select, this));
const int era_selection = create_engine_.find_extra_by_id(ng::create_engine::ERA, prefs::get().era());
const int era_selection = create_engine_.find_extra_by_id(ng::create_engine::ERA, prefs::get().mp_era());
if(era_selection >= 0) {
eras_menu_button_->set_selected(era_selection);
}
@ -344,7 +344,7 @@ void mp_create_game::pre_show(window& win)
win.add_to_keyboard_chain(&list);
// This handles the initial game selection as well
display_games_of_type(level_types_[get_initial_type_index()].first, prefs::get().level());
display_games_of_type(level_types_[get_initial_type_index()].first, prefs::get().mp_level());
// Initial tab selection must be done after game selection so the field widgets are set to their correct active state.
on_tab_select();
@ -883,9 +883,9 @@ void mp_create_game::post_show(window& window)
if(get_retval() == retval::OK) {
prefs::get().set_modifications(create_engine_.active_mods());
prefs::get().set_level_type(static_cast<int>(create_engine_.current_level_type()));
prefs::get().set_level(create_engine_.current_level().id());
prefs::get().set_era(create_engine_.current_era().id);
prefs::get().set_mp_level_type(static_cast<int>(create_engine_.current_level_type()));
prefs::get().set_mp_level(create_engine_.current_level().id());
prefs::get().set_mp_era(create_engine_.current_era().id);
create_engine_.prepare_for_era_and_mods();

View file

@ -165,7 +165,7 @@ void preferences_dialog::set_theme_list(menu_button& theme_list)
void preferences_dialog::set_gui2_theme_list(menu_button& theme_list)
{
std::string current_gui_theme_name = prefs::get().gui_theme();
std::string current_gui_theme_name = prefs::get().gui2_theme();
std::vector<config> options;
bool theme_found = false;
@ -373,7 +373,7 @@ void preferences_dialog::initialize_sound_option_group(const std::string& id_suf
}
/* SOUND FX wrappers for template */
static bool sound_on(){return prefs::get().sound_on();}
static bool sound(){return prefs::get().sound();}
static bool set_sound(bool v){return prefs::get().set_sound(v);}
static int sound_volume(){return prefs::get().sound_volume();}
static void set_sound_volume(int v){prefs::get().set_sound_volume(v);}
@ -448,8 +448,8 @@ void preferences_dialog::initialize_callbacks()
/* ENABLE PLANNING MODE */
register_bool("whiteboard_on_start", true,
[]() {return prefs::get().enable_whiteboard_mode_on_start();},
[](bool v) {prefs::get().set_enable_whiteboard_mode_on_start(v);});
[]() {return prefs::get().enable_planning_mode_on_start();},
[](bool v) {prefs::get().set_enable_planning_mode_on_start(v);});
/* HIDE ALLY PLANS */
register_bool("whiteboard_hide_allies", true,
@ -458,8 +458,8 @@ void preferences_dialog::initialize_callbacks()
/* INTERRUPT ON SIGHTING */
register_bool("interrupt_move_when_ally_sighted", true,
[]() {return prefs::get().interrupt_when_ally_sighted();},
[](bool v) {prefs::get().set_interrupt_when_ally_sighted(v);});
[]() {return prefs::get().ally_sighted_interrupts();},
[](bool v) {prefs::get().set_ally_sighted_interrupts(v);});
/* SAVE REPLAYS */
register_bool("save_replays", true,
@ -473,8 +473,8 @@ void preferences_dialog::initialize_callbacks()
/* MAX AUTO SAVES */
register_integer("max_saves_slider", true,
[]() {return prefs::get().autosavemax();},
[](int v) {prefs::get().set_autosavemax(v);});
[]() {return prefs::get().auto_save_max();},
[](int v) {prefs::get().set_auto_save_max(v);});
/* CACHE MANAGE */
connect_signal_mouse_left_click(find_widget<button>(this, "cachemg", false),
@ -530,8 +530,8 @@ void preferences_dialog::initialize_callbacks()
/* SHOW FLOATING LABELS */
register_bool("show_floating_labels", true,
[]() {return prefs::get().show_floating_labels();},
[](bool v) {prefs::get().set_show_floating_labels(v);});
[]() {return prefs::get().floating_labels();},
[](bool v) {prefs::get().set_floating_labels(v);});
/* SHOW TEAM COLORS */
register_bool("show_ellipses", true,
@ -599,7 +599,7 @@ void preferences_dialog::initialize_callbacks()
//
/* SOUND FX */
initialize_sound_option_group<sound_on, set_sound, sound_volume, set_sound_volume>("sfx");
initialize_sound_option_group<sound, set_sound, sound_volume, set_sound_volume>("sfx");
/* MUSIC */
initialize_sound_option_group<music_on, set_music, music_volume, set_music_volume>("music");
@ -625,8 +625,8 @@ void preferences_dialog::initialize_callbacks()
/* CHAT TIMESTAMPPING */
register_bool("chat_timestamps", true,
[]() {return prefs::get().chat_timestamping();},
[](bool v) {prefs::get().set_chat_timestamping(v);});
[]() {return prefs::get().chat_timestamp();},
[](bool v) {prefs::get().set_chat_timestamp(v);});
/* SAVE PASSWORD */
register_bool("remember_password", true,
@ -635,8 +635,8 @@ void preferences_dialog::initialize_callbacks()
/* WHISPERS FROM FRIENDS ONLY */
register_bool("lobby_whisper_friends_only", true,
[]() {return prefs::get().whisper_friends_only();},
[](bool v) {prefs::get().set_whisper_friends_only(v);});
[]() {return prefs::get().lobby_whisper_friends_only();},
[](bool v) {prefs::get().set_lobby_whisper_friends_only(v);});
/* LOBBY JOIN NOTIFICATIONS */
lobby_joins_group.add_member(find_widget<toggle_button>(this, "lobby_joins_none", false, true), pref_constants::lobby_joins::show_none);
@ -1215,7 +1215,7 @@ void preferences_dialog::handle_gui2_theme_select()
unsigned selected_theme = gui2_theme_list.get_value();
if (selected_theme != current_gui_theme_) {
current_gui_theme_ = selected_theme;
prefs::get().set_gui_theme(gui2_themes_.at(selected_theme));
prefs::get().set_gui2_theme(gui2_themes_.at(selected_theme));
set_retval(gui2::dialogs::title_screen::RELOAD_UI);
}
}

View file

@ -573,7 +573,7 @@ void title_screen::button_callback_cores()
for(const config& core : game_config_manager::get()->game_config().child_range("core")) {
cores.push_back(core);
if(core["id"] == prefs::get().core_id()) {
if(core["id"] == prefs::get().core()) {
current = cores.size() - 1;
}
}
@ -582,7 +582,7 @@ void title_screen::button_callback_cores()
if(core_dlg.show()) {
const std::string& core_id = cores[core_dlg.get_choice()]["id"];
prefs::get().set_core_id(core_id);
prefs::get().set_core(core_id);
get_window()->set_retval(RELOAD_GAME_DATA);
}
}

View file

@ -298,7 +298,7 @@ void chatbox::add_whisper_sent(const std::string& receiver, const std::string& m
void chatbox::add_whisper_received(const std::string& sender, const std::string& message)
{
bool can_go_to_active = !prefs::get().whisper_friends_only() || prefs::get().is_friend(sender);
bool can_go_to_active = !prefs::get().lobby_whisper_friends_only() || prefs::get().is_friend(sender);
bool can_open_new = prefs::get().auto_open_whisper_windows() && can_go_to_active;
if(whisper_window_open(sender, can_open_new)) {

View file

@ -367,23 +367,23 @@ bool command_executor::do_execute_command(const hotkey::ui_command& cmd, bool pr
surrender_game();
break;
case HOTKEY_MINIMAP_DRAW_TERRAIN:
prefs::get().toggle_minimap_draw_terrain();
prefs::get().set_minimap_draw_terrain(!prefs::get().minimap_draw_terrain());
recalculate_minimap();
break;
case HOTKEY_MINIMAP_CODING_TERRAIN:
prefs::get().toggle_minimap_terrain_coding();
prefs::get().set_minimap_terrain_coding(!prefs::get().minimap_terrain_coding());
recalculate_minimap();
break;
case HOTKEY_MINIMAP_CODING_UNIT:
prefs::get().toggle_minimap_movement_coding();
prefs::get().set_minimap_movement_coding(!prefs::get().minimap_movement_coding());
recalculate_minimap();
break;
case HOTKEY_MINIMAP_DRAW_UNITS:
prefs::get().toggle_minimap_draw_units();
prefs::get().set_minimap_draw_units(!prefs::get().minimap_draw_units());
recalculate_minimap();
break;
case HOTKEY_MINIMAP_DRAW_VILLAGES:
prefs::get().toggle_minimap_draw_villages();
prefs::get().set_minimap_draw_villages(!prefs::get().minimap_draw_villages());
recalculate_minimap();
break;
case HOTKEY_ACHIEVEMENTS:
@ -631,7 +631,7 @@ void command_executor::execute_command_wrap(const command_executor::queued_comma
prefs::get().set_animate_map(!prefs::get().animate_map());
break;
case HOTKEY_MOUSE_SCROLL:
prefs::get().enable_mouse_scroll(!prefs::get().mouse_scroll_enabled());
prefs::get().set_mouse_scrolling(!prefs::get().mouse_scrolling());
break;
case HOTKEY_MUTE:
{
@ -641,10 +641,10 @@ void command_executor::execute_command_wrap(const command_executor::queued_comma
bool playing_sound,playing_music;
before_muted_s() : playing_sound(false),playing_music(false){}
} before_muted;
if (prefs::get().music_on() || prefs::get().sound_on())
if (prefs::get().music_on() || prefs::get().sound())
{
// then remember settings and mute both
before_muted.playing_sound = prefs::get().sound_on();
before_muted.playing_sound = prefs::get().sound();
before_muted.playing_music = prefs::get().music_on();
prefs::get().set_sound(false);
prefs::get().set_music(false);

View file

@ -336,7 +336,7 @@ const language_def& get_locale()
assert(!known_languages.empty());
const std::string& prefs_locale = prefs::get().language();
const std::string& prefs_locale = prefs::get().locale();
if(prefs_locale.empty() == false) {
translation::set_language(prefs_locale, nullptr);
for(language_list::const_iterator i = known_languages.begin();

View file

@ -985,7 +985,7 @@ void menu_handler::execute_gotos(mouse_handler& mousehandler, int side)
void menu_handler::toggle_ellipses()
{
prefs::get().set_ellipses(!prefs::get().ellipses());
prefs::get().set_show_side_colors(!prefs::get().show_side_colors());
gui_->invalidate_all(); // TODO can fewer tiles be invalidated?
}

View file

@ -1042,7 +1042,7 @@ void play_controller::do_autosave()
{
scoped_savegame_snapshot snapshot(*this);
savegame::autosave_savegame save(saved_game_, prefs::get().save_compression_format());
save.autosave(false, prefs::get().autosavemax(), pref_constants::INFINITE_AUTO_SAVES);
save.autosave(false, prefs::get().auto_save_max(), pref_constants::INFINITE_AUTO_SAVES);
}
void play_controller::do_consolesave(const std::string& filename)

View file

@ -538,11 +538,11 @@ void playsingle_controller::before_human_turn()
return;
}
if(!did_autosave_this_turn_ && !game_config::disable_autosave && prefs::get().autosavemax() > 0) {
if(!did_autosave_this_turn_ && !game_config::disable_autosave && prefs::get().auto_save_max() > 0) {
did_autosave_this_turn_ = true;
scoped_savegame_snapshot snapshot(*this);
savegame::autosave_savegame save(saved_game_, prefs::get().save_compression_format());
save.autosave(game_config::disable_autosave, prefs::get().autosavemax(), pref_constants::INFINITE_AUTO_SAVES);
save.autosave(game_config::disable_autosave, prefs::get().auto_save_max(), pref_constants::INFINITE_AUTO_SAVES);
}
if(prefs::get().turn_bell()) {

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,7 @@
#pragma once
#include "config.hpp"
#include "desktop/notifications.hpp"
#include "filesystem.hpp"
#include "game_config.hpp"
#include "gui/sort_order.hpp"
@ -180,6 +181,14 @@ struct option
};
};
#define PREF_GETTER_SETTER(pref, type, def) \
void set_##pref(const type& value) { \
preferences_[prefs_list::pref] = value; \
} \
type pref() const { \
return preferences_[prefs_list::pref].to(def); \
}
class prefs
{
friend struct preferences_dialog_friend;
@ -201,36 +210,54 @@ class prefs
void reload_preferences();
std::set<std::string> all_attributes();
std::string core_id();
void set_core_id(const std::string& root);
// Proxies for preferences_dialog
void load_hotkeys();
void save_hotkeys();
void clear_hotkeys();
bool scroll_to_action();
void set_scroll_to_action(bool ison);
// not actually preferences
bool show_fps();
void set_show_fps(bool value);
bool message_private();
void set_message_private(bool value);
static void disable_preferences_save() {
no_preferences_save = true;
}
static bool preferences_save() {
return no_preferences_save;
}
// getter-only
bool message_bell();
bool middle_click_scrolls();
/** Gets the threshold for when to scroll. This scrolling happens when the mouse is in the application and near the border. */
int mouse_scroll_threshold();
bool confirm_load_save_from_different_version();
bool use_twelve_hour_clock_format();
sort_order::type addon_manager_saved_order_direction();
void set_addon_manager_saved_order_direction(sort_order::type value);
bool get_show_deprecation(bool def);
bool get_scroll_when_mouse_outside(bool def);
bool auto_open_whisper_windows();
bool show_combat();
std::string get_chat_timestamp(const std::time_t& t);
compression::format save_compression_format();
std::vector<std::string>* get_history(const std::string& id);
std::vector<preferences::option>& get_advanced_preferences() {return advanced_prefs_;}
// non-trivial getters+setters
point resolution();
void set_resolution(const point& res);
int pixel_scale();
void set_pixel_scale(const int scale);
bool auto_pixel_scale();
void set_auto_pixel_scale(bool choice);
bool maximized();
void set_maximized(bool ison);
bool fullscreen();
void set_fullscreen(bool ison);
bool vsync();
void set_vsync(bool ison);
bool turbo();
void set_turbo(bool ison);
double turbo_speed();
void set_turbo_speed(const double speed);
int font_scaling();
void set_font_scaling(int scale);
int font_scaled(int size);
@ -238,20 +265,7 @@ class prefs
int keepalive_timeout();
void keepalive_timeout(int seconds);
bool idle_anim();
void set_idle_anim(const bool ison);
int idle_anim_rate();
void set_idle_anim_rate(int rate);
std::string language();
void set_language(const std::string& s);
std::string gui_theme();
void set_gui_theme(const std::string& s);
// Don't rename it to sound() because of a gcc-3.3 branch bug which will cause it to conflict with the sound namespace.
bool sound_on();
bool sound();
bool set_sound(bool ison);
unsigned int sample_rate();
@ -275,25 +289,12 @@ class prefs
int music_volume();
void set_music_volume(int vol);
bool stop_music_in_background();
void set_stop_music_in_background(bool ison);
unsigned int tile_size();
void set_tile_size(const unsigned int size);
bool turn_bell();
bool set_turn_bell(bool ison);
bool ui_sound_on();
bool set_ui_sound(bool ison);
bool message_bell();
// Proxies for preferences_dialog
void load_hotkeys();
void save_hotkeys();
void clear_hotkeys();
void add_alias(const std::string& alias, const std::string& command);
optional_const_config get_alias();
@ -312,92 +313,125 @@ class prefs
std::string moved_color();
void set_moved_color(const std::string& color_id);
bool show_ally_orb();
void set_show_ally_orb(bool show_orb);
bool show_status_on_ally_orb();
void set_show_status_on_ally_orb(bool show_orb);
bool show_enemy_orb();
void set_show_enemy_orb(bool show_orb);
bool show_moved_orb();
void set_show_moved_orb(bool show_orb);
bool show_unmoved_orb();
void set_show_unmoved_orb(bool show_orb);
bool show_partial_orb();
void set_show_partial_orb(bool show_orb);
bool show_disengaged_orb();
void set_show_disengaged_orb(bool show_orb);
int scroll_speed();
void set_scroll_speed(const int scroll);
bool middle_click_scrolls();
bool mouse_scroll_enabled();
void enable_mouse_scroll(bool value);
void set_dir_bookmarks(const config& cfg);
optional_const_config dir_bookmarks();
/**
* Gets the threshold for when to scroll.
*
* This scrolling happens when the mouse is in the application and near the border.
*/
int mouse_scroll_threshold();
std::size_t editor_mru_limit();
std::vector<std::string> do_read_editor_mru();
void do_commit_editor_mru(const std::vector<std::string>& mru);
/** Retrieves the list of recently opened files. */
std::vector<std::string> recent_files();
/** Adds an entry to the recent files list. */
void add_recent_files_entry(const std::string& path);
int draw_delay();
void set_draw_delay(int value);
bool use_color_cursors();
void set_color_cursors(bool value);
bool animate_map();
void set_animate_map(bool value);
bool show_standing_animations();
void set_show_standing_animations(bool value);
bool animate_water();
void set_animate_water(bool value);
void show_wesnothd_server_search();
bool show_theme_dialog();
bool minimap_movement_coding();
void toggle_minimap_movement_coding();
void set_theme(const std::string& theme);
std::string theme();
bool minimap_terrain_coding();
void toggle_minimap_terrain_coding();
void set_mp_server_program_name(const std::string&);
std::string get_mp_server_program_name();
bool minimap_draw_units();
void toggle_minimap_draw_units();
bool parse_should_show_lobby_join(const std::string& sender, const std::string& message);
pref_constants::lobby_joins get_lobby_joins();
void set_lobby_joins(pref_constants::lobby_joins show);
bool minimap_draw_villages();
void toggle_minimap_draw_villages();
const std::map<std::string, preferences::acquaintance>& get_acquaintances();
const std::string get_ignored_delim();
std::map<std::string, std::string> get_acquaintances_nice(const std::string& filter);
std::pair<preferences::acquaintance*, bool> add_acquaintance(const std::string& nick, const std::string& mode, const std::string& notes);
void add_completed_campaign(const std::string&campaign_id, const std::string& difficulty_level);
bool remove_acquaintance(const std::string& nick);
bool is_friend(const std::string& nick);
bool is_ignored(const std::string& nick);
bool is_campaign_completed(const std::string& campaign_id);
bool is_campaign_completed(const std::string& campaign_id, const std::string& difficulty_level);
bool minimap_draw_terrain();
void toggle_minimap_draw_terrain();
const std::vector<game_config::server_info>& builtin_servers_list();
std::vector<game_config::server_info> user_servers_list();
void set_user_servers_list(const std::vector<game_config::server_info>& value);
bool show_fps();
void set_show_fps(bool value);
std::string network_host();
void set_network_host(const std::string& host);
bool ellipses();
void set_ellipses(bool ison);
std::string campaign_server();
void set_campaign_server(const std::string& host);
bool grid();
void set_grid(bool ison);
const config& options();
void set_options(const config& values);
bool confirm_load_save_from_different_version();
int countdown_init_time();
void set_countdown_init_time(int value);
void clear_countdown_init_time();
bool use_twelve_hour_clock_format();
int countdown_turn_bonus();
void set_countdown_turn_bonus(int value);
void clear_countdown_turn_bonus();
bool disable_auto_moves();
void set_disable_auto_moves(bool value);
int countdown_reservoir_time();
void set_countdown_reservoir_time(int value);
void clear_countdown_reservoir_time();
bool damage_prediction_allow_monte_carlo_simulation();
void set_damage_prediction_allow_monte_carlo_simulation(bool value);
int countdown_action_bonus();
void set_countdown_action_bonus(int value);
void clear_countdown_action_bonus();
std::string addon_manager_saved_order_name();
void set_addon_manager_saved_order_name(const std::string& value);
int village_gold();
void set_village_gold(int value);
sort_order::type addon_manager_saved_order_direction();
void set_addon_manager_saved_order_direction(sort_order::type value);
int village_support();
void set_village_support(int value);
std::string selected_achievement_group();
void set_selected_achievement_group(const std::string& content_for);
int xp_modifier();
void set_xp_modifier(int value);
bool remember_password();
void set_remember_password(bool remember);
std::string login();
void set_login(const std::string& login);
std::string password(const std::string& server, const std::string& login);
void set_password(const std::string& server, const std::string& login, const std::string& key);
const std::vector<std::string>& modifications(bool mp = true);
void set_modifications(const std::vector<std::string>& value, bool mp = true);
std::set<std::string>& encountered_units();
std::set<t_translation::terrain_code>& encountered_terrains();
// Ask for end turn confirmation
bool yellow_confirm();
bool green_confirm();
bool confirm_no_moves();
// Add all recruitable units as encountered so that information
// about them are displayed to the user in the help system.
void encounter_recruitable_units(const std::vector<team>& teams);
// Add all units that exist at the start to the encountered units so
// that information about them are displayed to the user in the help
// system.
void encounter_start_units(const unit_map& units);
// Add all units that are recallable as encountered units.
void encounter_recallable_units(const std::vector<team>& teams);
// Add all terrains on the map as encountered terrains.
void encounter_map_terrain(const gamemap& map);
// Calls all of the above functions on the current game board
void encounter_all_content(const game_board& gb);
/**
* @param content_for The achievement group the achievement is part of.
@ -448,358 +482,117 @@ class prefs
*/
void set_sub_achievement(const std::string& content_for, const std::string& id, const std::string& sub_id);
/**
* @param addon_id The chosen addon id from the editor to store in the preferences.
*/
void set_editor_chosen_addon(const std::string& addon_id);
/**
* @return The most recently selected add-on id from the editor. May be an empty string.
*/
std::string editor_chosen_addon();
void set_last_cache_cleared_version(const std::string& version);
std::string last_cache_cleared_version();
bool get_show_deprecation(bool def);
bool get_scroll_when_mouse_outside(bool def);
void set_dir_bookmarks(const config& cfg);
optional_const_config dir_bookmarks();
bool whisper_friends_only();
void set_whisper_friends_only(bool v);
bool auto_open_whisper_windows();
bool fi_invert();
void set_fi_invert(bool value);
bool fi_vacant_slots();
void set_fi_vacant_slots(bool value);
bool fi_friends_in_game();
void set_fi_friends_in_game(bool value);
bool fi_blocked_in_game();
void set_fi_blocked_in_game(bool value);
int editor_auto_update_transitions();
void set_editor_auto_update_transitions(int value);
std::string default_dir();
bool editor_draw_terrain_codes();
void set_editor_draw_terrain_codes(bool value);
bool editor_draw_hex_coordinates();
void set_editor_draw_hex_coordinates(bool value);
bool editor_draw_num_of_bitmaps();
void set_editor_draw_num_of_bitmaps(bool value);
bool editor_help_text_shown();
void set_editor_help_text_shown(bool value);
std::size_t editor_mru_limit();
std::vector<std::string> do_read_editor_mru();
void do_commit_editor_mru(const std::vector<std::string>& mru);
/** Retrieves the list of recently opened files. */
std::vector<std::string> recent_files();
/** Adds an entry to the recent files list. */
void add_recent_files_entry(const std::string& path);
bool use_color_cursors();
void set_color_cursors(bool value);
bool show_standing_animations();
void set_show_standing_animations(bool value);
void show_wesnothd_server_search();
bool show_theme_dialog();
void set_theme(const std::string& theme);
std::string theme();
void set_mp_server_program_name(const std::string&);
std::string get_mp_server_program_name();
bool parse_should_show_lobby_join(const std::string& sender, const std::string& message);
pref_constants::lobby_joins get_lobby_joins();
void set_lobby_joins(pref_constants::lobby_joins show);
const std::map<std::string, preferences::acquaintance>& get_acquaintances();
const std::string get_ignored_delim();
std::map<std::string, std::string> get_acquaintances_nice(const std::string& filter);
std::pair<preferences::acquaintance*, bool> add_acquaintance(const std::string& nick, const std::string& mode, const std::string& notes);
void add_completed_campaign(const std::string&campaign_id, const std::string& difficulty_level);
bool remove_acquaintance(const std::string& nick);
bool is_friend(const std::string& nick);
bool is_ignored(const std::string& nick);
bool is_campaign_completed(const std::string& campaign_id);
bool is_campaign_completed(const std::string& campaign_id, const std::string& difficulty_level);
const std::vector<game_config::server_info>& builtin_servers_list();
std::vector<game_config::server_info> user_servers_list();
void set_user_servers_list(const std::vector<game_config::server_info>& value);
std::string network_host();
void set_network_host(const std::string& host);
std::string campaign_server();
void set_campaign_server(const std::string& host);
bool turn_dialog();
void set_turn_dialog(bool ison);
bool enable_whiteboard_mode_on_start();
void set_enable_whiteboard_mode_on_start(bool value);
bool hide_whiteboard();
void set_hide_whiteboard(bool value);
bool show_combat();
bool allow_observers();
void set_allow_observers(bool value);
bool shuffle_sides();
void set_shuffle_sides(bool value);
std::string random_faction_mode();
void set_random_faction_mode(const std::string& value);
bool use_map_settings();
void set_use_map_settings(bool value);
int mp_server_warning_disabled();
void set_mp_server_warning_disabled(int value);
bool random_start_time();
void set_random_start_time(bool value);
bool fog();
void set_fog(bool value);
bool shroud();
void set_shroud(bool value);
int turns();
void set_turns(int value);
const config& options();
void set_options(const config& values);
bool skip_mp_replay();
void set_skip_mp_replay(bool value);
bool blindfold_replay();
void set_blindfold_replay(bool value);
bool countdown();
void set_countdown(bool value);
int countdown_init_time();
void set_countdown_init_time(int value);
void clear_countdown_init_time();
int countdown_turn_bonus();
void set_countdown_turn_bonus(int value);
void clear_countdown_turn_bonus();
int countdown_reservoir_time();
void set_countdown_reservoir_time(int value);
void clear_countdown_reservoir_time();
int countdown_action_bonus();
void set_countdown_action_bonus(int value);
void clear_countdown_action_bonus();
int village_gold();
void set_village_gold(int value);
int village_support();
void set_village_support(int value);
int xp_modifier();
void set_xp_modifier(int value);
std::string era();
void set_era(const std::string& value);
std::string level();
void set_level(const std::string& value);
int level_type();
void set_level_type(int value);
const std::vector<std::string>& modifications(bool mp = true);
void set_modifications(const std::vector<std::string>& value, bool mp = true);
bool skip_ai_moves();
void set_skip_ai_moves(bool value);
void set_show_side_colors(bool value);
bool show_side_colors();
bool save_replays();
void set_save_replays(bool value);
bool delete_saves();
void set_delete_saves(bool value);
void set_ask_delete_saves(bool value);
bool ask_delete_saves();
void set_interrupt_when_ally_sighted(bool value);
bool interrupt_when_ally_sighted();
void set_autosavemax(int value);
int autosavemax();
bool show_floating_labels();
void set_show_floating_labels(bool value);
bool message_private();
void set_message_private(bool value);
// Multiplayer functions
std::string get_chat_timestamp(const std::time_t& t);
bool chat_timestamping();
void set_chat_timestamping(bool value);
int chat_lines();
void set_chat_lines(int lines);
int chat_message_aging();
void set_chat_message_aging(const int aging);
bool show_all_units_in_help();
void set_show_all_units_in_help(bool value);
compression::format save_compression_format();
std::set<std::string>& encountered_units();
std::set<t_translation::terrain_code>& encountered_terrains();
std::string custom_command();
void set_custom_command(const std::string& command);
std::vector<std::string>* get_history(const std::string& id);
// Ask for end turn confirmation
bool yellow_confirm();
bool green_confirm();
bool confirm_no_moves();
// Add all recruitable units as encountered so that information
// about them are displayed to the user in the help system.
void encounter_recruitable_units(const std::vector<team>& teams);
// Add all units that exist at the start to the encountered units so
// that information about them are displayed to the user in the help
// system.
void encounter_start_units(const unit_map& units);
// Add all units that are recallable as encountered units.
void encounter_recallable_units(const std::vector<team>& teams);
// Add all terrains on the map as encountered terrains.
void encounter_map_terrain(const gamemap& map);
// Calls all of the above functions on the current game board
void encounter_all_content(const game_board& gb);
bool player_joins_sound();
void set_player_joins_sound(bool val);
bool player_joins_lobby();
void set_player_joins_lobby(bool val);
bool player_joins_notif();
void set_player_joins_notif(bool val);
bool player_leaves_sound();
void set_player_leaves_sound(bool val);
bool player_leaves_lobby();
void set_player_leaves_lobby(bool val);
bool player_leaves_notif();
void set_player_leaves_notif(bool val);
bool private_message_sound();
void set_private_message_sound(bool val);
bool private_message_lobby();
void set_private_message_lobby(bool val);
bool private_message_notif();
void set_private_message_notif(bool val);
bool friend_message_sound();
void set_friend_message_sound(bool val);
bool friend_message_lobby();
void set_friend_message_lobby(bool val);
bool friend_message_notif();
void set_friend_message_notif(bool val);
bool public_message_sound();
void set_public_message_sound(bool val);
bool public_message_lobby();
void set_public_message_lobby(bool val);
bool public_message_notif();
void set_public_message_notif(bool val);
bool server_message_sound();
void set_server_message_sound(bool val);
bool server_message_lobby();
void set_server_message_lobby(bool val);
bool server_message_notif();
void set_server_message_notif(bool val);
bool ready_for_start_sound();
void set_ready_for_start_sound(bool val);
bool ready_for_start_lobby();
void set_ready_for_start_lobby(bool val);
bool ready_for_start_notif();
void set_ready_for_start_notif(bool val);
bool game_has_begun_sound();
void set_game_has_begun_sound(bool val);
bool game_has_begun_lobby();
void set_game_has_begun_lobby(bool val);
bool game_has_begun_notif();
void set_game_has_begun_notif(bool val);
bool turn_changed_sound();
void set_turn_changed_sound(bool val);
bool turn_changed_lobby();
void set_turn_changed_lobby(bool val);
bool turn_changed_notif();
void set_turn_changed_notif(bool val);
bool game_created_sound();
void set_game_created_sound(bool val);
bool game_created_lobby();
void set_game_created_lobby(bool val);
bool game_created_notif();
void set_game_created_notif(bool val);
PREF_GETTER_SETTER(show_ally_orb, bool, game_config::show_ally_orb)
PREF_GETTER_SETTER(show_status_on_ally_orb, bool, game_config::show_status_on_ally_orb)
PREF_GETTER_SETTER(show_enemy_orb, bool, game_config::show_enemy_orb)
PREF_GETTER_SETTER(show_moved_orb, bool, game_config::show_moved_orb)
PREF_GETTER_SETTER(show_unmoved_orb, bool, game_config::show_unmoved_orb)
PREF_GETTER_SETTER(show_partial_orb, bool, game_config::show_partial_orb)
PREF_GETTER_SETTER(show_disengaged_orb, bool, game_config::show_disengaged_orb)
PREF_GETTER_SETTER(core, std::string, std::string("default"))
PREF_GETTER_SETTER(scroll_to_action, bool, true)
PREF_GETTER_SETTER(auto_pixel_scale, bool, true)
PREF_GETTER_SETTER(maximized, bool, !fullscreen())
PREF_GETTER_SETTER(fullscreen, bool, true)
PREF_GETTER_SETTER(vsync, bool, true)
PREF_GETTER_SETTER(turbo_speed, double, 2.0)
PREF_GETTER_SETTER(idle_anim, bool, true)
PREF_GETTER_SETTER(idle_anim_rate, int, 0)
PREF_GETTER_SETTER(locale, std::string, std::string(""))
PREF_GETTER_SETTER(gui2_theme, std::string, std::string(""))
PREF_GETTER_SETTER(stop_music_in_background, bool, false)
PREF_GETTER_SETTER(tile_size, unsigned, 0)
PREF_GETTER_SETTER(mouse_scrolling, bool, true)
PREF_GETTER_SETTER(draw_delay, int, -1)
PREF_GETTER_SETTER(animate_map, bool, true)
PREF_GETTER_SETTER(animate_water, bool, true)
PREF_GETTER_SETTER(minimap_movement_coding, bool, true)
PREF_GETTER_SETTER(minimap_terrain_coding, bool, true)
PREF_GETTER_SETTER(minimap_draw_units, bool, true)
PREF_GETTER_SETTER(minimap_draw_villages, bool, true)
PREF_GETTER_SETTER(minimap_draw_terrain, bool, true)
PREF_GETTER_SETTER(show_side_colors, bool, true)
PREF_GETTER_SETTER(grid, bool, false)
PREF_GETTER_SETTER(disable_auto_moves, bool, false)
PREF_GETTER_SETTER(damage_prediction_allow_monte_carlo_simulation, bool, true)
PREF_GETTER_SETTER(addon_manager_saved_order_name, std::string, std::string(""))
PREF_GETTER_SETTER(selected_achievement_group, std::string, std::string(""))
/** The most recently selected add-on id from the editor. May be an empty string. */
PREF_GETTER_SETTER(editor_chosen_addon, std::string, std::string(""))
PREF_GETTER_SETTER(_last_cache_cleaned_ver, std::string, std::string(""))
PREF_GETTER_SETTER(lobby_whisper_friends_only, bool, false)
PREF_GETTER_SETTER(fi_invert, bool, false)
PREF_GETTER_SETTER(fi_vacant_slots, bool, false)
PREF_GETTER_SETTER(fi_friends_in_game, bool, false)
PREF_GETTER_SETTER(fi_blocked_in_game, bool, false)
PREF_GETTER_SETTER(editor_auto_update_transitions, int, pref_constants::TRANSITION_UPDATE_PARTIAL)
PREF_GETTER_SETTER(editor_draw_terrain_codes, bool, false)
PREF_GETTER_SETTER(editor_draw_hex_coordinates, bool, false)
PREF_GETTER_SETTER(editor_draw_num_of_bitmaps, bool, false)
PREF_GETTER_SETTER(turn_dialog, bool, false)
PREF_GETTER_SETTER(enable_planning_mode_on_start, bool, false)
PREF_GETTER_SETTER(hide_whiteboard, bool, false)
PREF_GETTER_SETTER(allow_observers, bool, true)
PREF_GETTER_SETTER(shuffle_sides, bool, false)
PREF_GETTER_SETTER(random_faction_mode, std::string, std::string(""))
PREF_GETTER_SETTER(mp_use_map_settings, bool, true)
PREF_GETTER_SETTER(mp_server_warning_disabled, int, 0)
PREF_GETTER_SETTER(mp_random_start_time, bool, true)
PREF_GETTER_SETTER(mp_fog, bool, true)
PREF_GETTER_SETTER(mp_shroud, bool, true)
PREF_GETTER_SETTER(mp_turns, int, 0)
PREF_GETTER_SETTER(skip_mp_replay, bool, false)
PREF_GETTER_SETTER(blindfold_replay, bool, false)
PREF_GETTER_SETTER(mp_countdown, bool, false)
PREF_GETTER_SETTER(mp_era, std::string, std::string(""))
PREF_GETTER_SETTER(mp_level, std::string, std::string(""))
PREF_GETTER_SETTER(mp_level_type, int, 0)
PREF_GETTER_SETTER(skip_ai_moves, bool, false)
PREF_GETTER_SETTER(save_replays, bool, true)
PREF_GETTER_SETTER(delete_saves, bool, false)
PREF_GETTER_SETTER(ask_delete, bool, true)
PREF_GETTER_SETTER(ally_sighted_interrupts, bool, true)
PREF_GETTER_SETTER(auto_save_max, int, 10)
PREF_GETTER_SETTER(floating_labels, bool, true)
PREF_GETTER_SETTER(chat_timestamp, bool, false)
PREF_GETTER_SETTER(chat_lines, int, 6)
PREF_GETTER_SETTER(chat_message_aging, int, 20)
PREF_GETTER_SETTER(show_all_units_in_help, bool, false)
PREF_GETTER_SETTER(custom_command, std::string, std::string(""))
PREF_GETTER_SETTER(player_joins_sound, bool, true)
PREF_GETTER_SETTER(player_joins_lobby, bool, false)
PREF_GETTER_SETTER(player_joins_notif, bool, false)
PREF_GETTER_SETTER(player_leaves_sound, bool, true)
PREF_GETTER_SETTER(player_leaves_lobby, bool, false)
PREF_GETTER_SETTER(player_leaves_notif, bool, false)
PREF_GETTER_SETTER(private_message_sound, bool, true)
PREF_GETTER_SETTER(private_message_lobby, bool, desktop::notifications::available())
PREF_GETTER_SETTER(private_message_notif, bool, true)
PREF_GETTER_SETTER(friend_message_sound, bool, false)
PREF_GETTER_SETTER(friend_message_lobby, bool, false)
PREF_GETTER_SETTER(friend_message_notif, bool, false)
PREF_GETTER_SETTER(public_message_sound, bool, false)
PREF_GETTER_SETTER(public_message_lobby, bool, false)
PREF_GETTER_SETTER(public_message_notif, bool, false)
PREF_GETTER_SETTER(server_message_sound, bool, true)
PREF_GETTER_SETTER(server_message_lobby, bool, false)
PREF_GETTER_SETTER(server_message_notif, bool, true)
PREF_GETTER_SETTER(ready_for_start_sound, bool, true)
PREF_GETTER_SETTER(ready_for_start_lobby, bool, desktop::notifications::available())
PREF_GETTER_SETTER(ready_for_start_notif, bool, false)
PREF_GETTER_SETTER(game_has_begun_sound, bool, true)
PREF_GETTER_SETTER(game_has_begun_lobby, bool, desktop::notifications::available())
PREF_GETTER_SETTER(game_has_begun_notif, bool, false)
PREF_GETTER_SETTER(turn_changed_sound, bool, true)
PREF_GETTER_SETTER(turn_changed_lobby, bool, desktop::notifications::available())
PREF_GETTER_SETTER(turn_changed_notif, bool, false)
PREF_GETTER_SETTER(game_created_sound, bool, true)
PREF_GETTER_SETTER(game_created_lobby, bool, desktop::notifications::available())
PREF_GETTER_SETTER(game_created_notif, bool, true)
PREF_GETTER_SETTER(editor_help_text_shown, bool, true)
#undef PREF_GETTER_SETTER
void clear_mp_alert_prefs();
bool remember_password();
void set_remember_password(bool remember);
std::string login();
void set_login(const std::string& login);
std::string password(const std::string& server, const std::string& login);
void set_password(const std::string& server, const std::string& login, const std::string& key);
std::vector<preferences::option>& get_advanced_preferences() {return advanced_prefs_;}
static void disable_preferences_save() {
no_preferences_save = true;
}
static bool preferences_save() {
return no_preferences_save;
}
private:
prefs();
// don't move, assign, or copy a singleton

View file

@ -16,6 +16,8 @@
#include "enum_base.hpp"
#define ADDPREF(pref) static constexpr const char* const pref = #pref;
/**
* Contains all valid preferences attributes.
*/
@ -25,358 +27,358 @@ struct preferences_list_defines
// regular preferences
//
/** wesnoth version string when cache files were last deleted */
static constexpr const char* const _last_cache_cleaned_ver = "_last_cache_cleaned_ver";
ADDPREF(_last_cache_cleaned_ver)
/** achievements completed for add-ons/UMC, are not steam achievements */
static constexpr const char* const achievements = "achievements";
ADDPREF(achievements)
/** the sort direction, ie: ascending */
static constexpr const char* const addon_manager_saved_order_direction = "addon_manager_saved_order_direction";
ADDPREF(addon_manager_saved_order_direction)
/** the name of the column in the add-ons manager to use by default to sort results */
static constexpr const char* const addon_manager_saved_order_name = "addon_manager_saved_order_name";
ADDPREF(addon_manager_saved_order_name)
/** set an alternate way to call a command, similar to linux terminal command aliases */
static constexpr const char* const alias = "alias";
ADDPREF(alias)
/** whether a game should allow observers */
static constexpr const char* const allow_observers = "allow_observers";
ADDPREF(allow_observers)
/** the orb color above allied units */
static constexpr const char* const ally_orb_color = "ally_orb_color";
ADDPREF(ally_orb_color)
/** whether to stop movement of a unit when an allied unit comes into sight range */
static constexpr const char* const ally_sighted_interrupts = "ally_sighted_interrupts";
ADDPREF(ally_sighted_interrupts)
/** whether to display animations on terrain (ie: windmill) */
static constexpr const char* const animate_map = "animate_map";
ADDPREF(animate_map)
/** whether to animate water terrain */
static constexpr const char* const animate_water = "animate_water";
ADDPREF(animate_water)
/** whether to automatically set the pixel scale multiplier based on the current window size */
static constexpr const char* const auto_pixel_scale = "auto_pixel_scale";
ADDPREF(auto_pixel_scale)
/** the maximum number of autosaves to keep before deleting old ones */
static constexpr const char* const auto_save_max = "auto_save_max";
ADDPREF(auto_save_max)
/** how loud the turn bell sound is */
static constexpr const char* const bell_volume = "bell_volume";
ADDPREF(bell_volume)
/** whether to show the map before being given a side in online multiplayer */
static constexpr const char* const blindfold_replay = "blindfold_replay";
ADDPREF(blindfold_replay)
/** the add-ons server name, ie: add-ons.wesnoth.org */
static constexpr const char* const campaign_server = "campaign_server";
ADDPREF(campaign_server)
/** the number of lines of chat to display in-game */
static constexpr const char* const chat_lines = "chat_lines";
ADDPREF(chat_lines)
/** whether to show a timestamp in in-game chat messages */
static constexpr const char* const chat_timestamp = "chat_timestamp";
ADDPREF(chat_timestamp)
/** child tag name for completed campaign information */
static constexpr const char* const completed_campaigns = "completed_campaigns";
ADDPREF(completed_campaigns)
/** whether to confirm ending your turn when units can still take action */
static constexpr const char* const confirm_end_turn = "confirm_end_turn";
ADDPREF(confirm_end_turn)
/** the current core to use */
static constexpr const char* const core = "core";
ADDPREF(core)
/**
* creates a single command composed of one or more other commands
* format - :custom show_terrain_codes;show_num_of_bitmaps
*/
static constexpr const char* const custom_command = "custom_command";
ADDPREF(custom_command)
/** whether to show a confirmation dialog when deleting a save */
static constexpr const char* const delete_saves = "delete_saves";
ADDPREF(delete_saves)
/** additional folders shown when using the file selection dialog */
static constexpr const char* const dir_bookmarks = "dir_bookmarks";
ADDPREF(dir_bookmarks)
/** whether to automatically move units that were previously told to move towards hexes more than one turn away */
static constexpr const char* const disable_auto_moves = "disable_auto_moves";
ADDPREF(disable_auto_moves)
/** used to enforce the FPS limit - minimum time between frame updates if the player's PC is capable of updating the screen faster than this */
static constexpr const char* const draw_delay = "draw_delay";
ADDPREF(draw_delay)
/** whether to have the editor automatically update terrain transitions when placing terrain immediately, after the mouse click is released, or not at all */
static constexpr const char* const editor_auto_update_transitions = "editor_auto_update_transitions";
ADDPREF(editor_auto_update_transitions)
/** the current add-on being used in the editor */
static constexpr const char* const editor_chosen_addon = "editor_chosen_addon";
ADDPREF(editor_chosen_addon)
/** whether to draw the x,y map coordinates in the editor */
static constexpr const char* const editor_draw_hex_coordinates = "editor_draw_hex_coordinates";
ADDPREF(editor_draw_hex_coordinates)
/** number of images used to draw the hex */
static constexpr const char* const editor_draw_num_of_bitmaps = "editor_draw_num_of_bitmaps";
ADDPREF(editor_draw_num_of_bitmaps)
/** whether to draw terrain codes on hexes in the editor */
static constexpr const char* const editor_draw_terrain_codes = "editor_draw_terrain_codes";
ADDPREF(editor_draw_terrain_codes)
/** list of recently accessed files in the editor */
static constexpr const char* const editor_recent_files = "editor_recent_files";
ADDPREF(editor_recent_files)
/** whether to display the active tool information help text at the bottom/top of the editor */
static constexpr const char* const editor_help_text_shown = "editor_help_text_shown";
ADDPREF(editor_help_text_shown)
/** whether to automatically start in planning mode in-game */
static constexpr const char* const enable_planning_mode_on_start = "enable_planning_mode_on_start";
ADDPREF(enable_planning_mode_on_start)
/** list of terrain seen so far */
static constexpr const char* const encountered_terrain_list = "encountered_terrain_list";
ADDPREF(encountered_terrain_list)
/** list of units seen so far */
static constexpr const char* const encountered_units = "encountered_units";
ADDPREF(encountered_units)
/** the color of the orb over enemy units */
static constexpr const char* const enemy_orb_color = "enemy_orb_color";
ADDPREF(enemy_orb_color)
/** in the multiplayer lobby, show games with blocked players in them */
static constexpr const char* const fi_blocked_in_game = "fi_blocked_in_game";
ADDPREF(fi_blocked_in_game)
/** in the multiplayer lobby, show games with friends in them */
static constexpr const char* const fi_friends_in_game = "fi_friends_in_game";
ADDPREF(fi_friends_in_game)
/** in the multiplayer lobby, invert all other filters */
static constexpr const char* const fi_invert = "fi_invert";
ADDPREF(fi_invert)
/** in the multiplayer lobby, show games with vacant slots */
static constexpr const char* const fi_vacant_slots = "fi_vacant_slots";
ADDPREF(fi_vacant_slots)
/** whether to show floating labels on the game map */
static constexpr const char* const floating_labels = "floating_labels";
ADDPREF(floating_labels)
/** whether to use fullscreen mode */
static constexpr const char* const fullscreen = "fullscreen";
ADDPREF(fullscreen)
/** whether to show a hex grid overlay on the map */
static constexpr const char* const grid = "grid";
ADDPREF(grid)
/** the gui2 theme name */
static constexpr const char* const gui2_theme = "gui2_theme";
ADDPREF(gui2_theme)
/** whether to show teammate's whiteboard plans on the game map */
static constexpr const char* const hide_whiteboard = "hide_whiteboard";
ADDPREF(hide_whiteboard)
/** list of lines of text entered into textboxes that support keeping a history */
static constexpr const char* const history = "history";
ADDPREF(history)
/** the most recent multiplayer server hostname */
static constexpr const char* const host = "host";
ADDPREF(host)
/** whether to play idle animations */
static constexpr const char* const idle_anim = "idle_anim";
ADDPREF(idle_anim)
/** how frequently to play idle animations */
static constexpr const char* const idle_anim_rate = "idle_anim_rate";
ADDPREF(idle_anim_rate)
/** who to show notifications about when they join the multiplayer lobby */
static constexpr const char* const lobby_joins = "lobby_joins";
ADDPREF(lobby_joins)
/** whether to only accept whisper messages from friends */
static constexpr const char* const lobby_whisper_friends_only = "lobby_whisper_friends_only";
ADDPREF(lobby_whisper_friends_only)
/** player chosen language to use */
static constexpr const char* const locale = "locale";
ADDPREF(locale)
/** most recently use username for logging into the multiplayer server */
static constexpr const char* const login = "login";
ADDPREF(login)
/** whether the window is maximized */
static constexpr const char* const maximized = "maximized";
ADDPREF(maximized)
/** whether to play a sound when receiving a message */
static constexpr const char* const message_bell = "message_bell";
ADDPREF(message_bell)
/** whether to draw terrain in the in-game minimap */
static constexpr const char* const minimap_draw_terrain = "minimap_draw_terrain";
ADDPREF(minimap_draw_terrain)
/** whether to draw units on in-game/editor minimap */
static constexpr const char* const minimap_draw_units = "minimap_draw_units";
ADDPREF(minimap_draw_units)
/** whether to draw villages on the in-game/editor minimap */
static constexpr const char* const minimap_draw_villages = "minimap_draw_villages";
ADDPREF(minimap_draw_villages)
/**
* on the in-game minimap/editor minimap use a color for your side, a color for all allied sides, and a color for all enemy sides
* doesn't actually have anything to do with movement
*/
static constexpr const char* const minimap_movement_coding = "minimap_movement_coding";
ADDPREF(minimap_movement_coding)
/** simplified color coding by terrain type in the in-game minimap/editor */
static constexpr const char* const minimap_terrain_coding = "minimap_terrain_coding";
ADDPREF(minimap_terrain_coding)
/** the color of the orb above a unit that can no longer move */
static constexpr const char* const moved_orb_color = "moved_orb_color";
ADDPREF(moved_orb_color)
/** whether to enable the turn timer in multiplayer */
static constexpr const char* const mp_countdown = "mp_countdown";
ADDPREF(mp_countdown)
/** seconds to add to the multiplayer turn timer when an action is taken */
static constexpr const char* const mp_countdown_action_bonus = "mp_countdown_action_bonus";
ADDPREF(mp_countdown_action_bonus)
/** seconds for the multiplayer turn timer for each player's first turn */
static constexpr const char* const mp_countdown_init_time = "mp_countdown_init_time";
ADDPREF(mp_countdown_init_time)
/** maximum seconds the multiplayer turn timer can have for a single turn */
static constexpr const char* const mp_countdown_reservoir_time = "mp_countdown_reservoir_time";
ADDPREF(mp_countdown_reservoir_time)
/** bonus seconds for the multiplayer turn timer for turns after turn 1 */
static constexpr const char* const mp_countdown_turn_bonus = "mp_countdown_turn_bonus";
ADDPREF(mp_countdown_turn_bonus)
/** the most recently played era in multiplayer */
static constexpr const char* const mp_era = "mp_era";
ADDPREF(mp_era)
/** whether to enable fog in multiplayer games */
static constexpr const char* const mp_fog = "mp_fog";
ADDPREF(mp_fog)
/** the id of the most recently played multiplayer scenario */
static constexpr const char* const mp_level = "mp_level";
ADDPREF(mp_level)
/** most recently selected type of game: scenario, campaign, random map, etc */
static constexpr const char* const mp_level_type = "mp_level_type";
ADDPREF(mp_level_type)
/** list of the last selected multiplayer modifications */
static constexpr const char* const mp_modifications = "mp_modifications";
ADDPREF(mp_modifications)
/** whether to use a random start time for the scenario */
static constexpr const char* const mp_random_start_time = "mp_random_start_time";
ADDPREF(mp_random_start_time)
/** the name of the wesnothd executable */
static constexpr const char* const mp_server_program_name = "mp_server_program_name";
ADDPREF(mp_server_program_name)
/** whether to show a warning dialog about starting wesnothd in the background when hosting LAN games */
static constexpr const char* const mp_server_warning_disabled = "mp_server_warning_disabled";
ADDPREF(mp_server_warning_disabled)
/** whether to enable shroud in multiplayer games */
static constexpr const char* const mp_shroud = "mp_shroud";
ADDPREF(mp_shroud)
/** the turn limit for multiplayer games */
static constexpr const char* const mp_turns = "mp_turns";
ADDPREF(mp_turns)
/** whether to use the scenario's default settings */
static constexpr const char* const mp_use_map_settings = "mp_use_map_settings";
ADDPREF(mp_use_map_settings)
/** the amount of gold each village gives */
static constexpr const char* const mp_village_gold = "mp_village_gold";
ADDPREF(mp_village_gold)
/** the amount of unit upkeep each village offsets */
static constexpr const char* const mp_village_support = "mp_village_support";
ADDPREF(mp_village_support)
/** the multiplier to apply to all units in a multiplayer game */
static constexpr const char* const mp_xp_modifier = "mp_xp_modifier";
ADDPREF(mp_xp_modifier)
/** whether music is enabled */
static constexpr const char* const music = "music";
ADDPREF(music)
/** the music's volume */
static constexpr const char* const music_volume = "music_volume";
ADDPREF(music_volume)
/** custom multiplayer scenario options */
static constexpr const char* const options = "options";
ADDPREF(options)
/** the orb above units with that can still take some actions */
static constexpr const char* const partial_orb_color = "partial_orb_color";
ADDPREF(partial_orb_color)
/** the pixel scale multiplier to apply */
static constexpr const char* const pixel_scale = "pixel_scale";
ADDPREF(pixel_scale)
/** whether to allow any type of mirrors in a multiplayer scenario */
static constexpr const char* const random_faction_mode = "random_faction_mode";
ADDPREF(random_faction_mode)
/** whether to remember passwords typed into password fields */
static constexpr const char* const remember_password = "remember_password";
ADDPREF(remember_password)
/** audio sample rate */
static constexpr const char* const sample_rate = "sample_rate";
ADDPREF(sample_rate)
/** whether to save replays of games */
static constexpr const char* const save_replays = "save_replays";
ADDPREF(save_replays)
/** the scroll speed */
static constexpr const char* const scroll = "scroll";
ADDPREF(scroll)
/** how close the mouse needs to get to the edge of the screen to start scrolling */
static constexpr const char* const scroll_threshold = "scroll_threshold";
ADDPREF(scroll_threshold)
/** the most recently selected achievement group in the achievements dialog */
static constexpr const char* const selected_achievement_group = "selected_achievement_group";
ADDPREF(selected_achievement_group)
/** whether to show an orb over allied units */
static constexpr const char* const show_ally_orb = "show_ally_orb";
ADDPREF(show_ally_orb)
/** whether to show an orb over disengaged units */
static constexpr const char* const show_disengaged_orb = "show_disengaged_orb";
ADDPREF(show_disengaged_orb)
/** whether to show an orb over enemy units */
static constexpr const char* const show_enemy_orb = "show_enemy_orb";
ADDPREF(show_enemy_orb)
/** whether to show an orb over units that have used all their actions */
static constexpr const char* const show_moved_orb = "show_moved_orb";
ADDPREF(show_moved_orb)
/** whether to show an orb over units that have only use some of their actions */
static constexpr const char* const show_partial_orb = "show_partial_orb";
ADDPREF(show_partial_orb)
/** whether to show the team colored circle under units */
static constexpr const char* const show_side_colors = "show_side_colors";
ADDPREF(show_side_colors)
/** whether to show unit status (moved, unmoved, etc) for allied units as well */
static constexpr const char* const show_status_on_ally_orb = "show_status_on_ally_orb";
ADDPREF(show_status_on_ally_orb)
/** whether to show an orb over units that haven't done anything */
static constexpr const char* const show_unmoved_orb = "show_unmoved_orb";
ADDPREF(show_unmoved_orb)
/** whether to randomly assign sides in multiplayer games */
static constexpr const char* const shuffle_sides = "shuffle_sides";
ADDPREF(shuffle_sides)
/** whether to skip move animations for AI actions */
static constexpr const char* const skip_ai_moves = "skip_ai_moves";
ADDPREF(skip_ai_moves)
/** whether to skip animation of all actions when joining an in-progress multiplayer game */
static constexpr const char* const skip_mp_replay = "skip_mp_replay";
ADDPREF(skip_mp_replay)
/** whether to play non-UI sounds */
static constexpr const char* const sound = "sound";
ADDPREF(sound)
/** audio buffer size */
static constexpr const char* const sound_buffer_size = "sound_buffer_size";
ADDPREF(sound_buffer_size)
/** the volume for playing sounds */
static constexpr const char* const sound_volume = "sound_volume";
ADDPREF(sound_volume)
/** list of the last selected single player modifications */
static constexpr const char* const sp_modifications = "sp_modifications";
ADDPREF(sp_modifications)
/** whether to continue playing music when wesnoth isn't the focused window */
static constexpr const char* const stop_music_in_background = "stop_music_in_background";
ADDPREF(stop_music_in_background)
/** the ThemeWML theme */
static constexpr const char* const theme = "theme";
ADDPREF(theme)
/** hex size used to determine zoom level */
static constexpr const char* const tile_size = "tile_size";
ADDPREF(tile_size)
/** whether to enable accelerated animation speed */
static constexpr const char* const turbo = "turbo";
ADDPREF(turbo)
/** how much to accelerate animation speed */
static constexpr const char* const turbo_speed = "turbo_speed";
ADDPREF(turbo_speed)
/** whether to play a sound when it's your turn */
static constexpr const char* const turn_bell = "turn_bell";
ADDPREF(turn_bell)
/** whether to show a dialog and add a blindfold between turns */
static constexpr const char* const turn_dialog = "turn_dialog";
ADDPREF(turn_dialog)
/** whether to play sounds when clicking UI elements */
static constexpr const char* const ui_sound = "UI_sound";
ADDPREF(ui_sound)
/** how loud to make the sound when clicking UI elements */
static constexpr const char* const ui_volume = "UI_volume";
ADDPREF(ui_volume)
/** whether to show standing animations */
static constexpr const char* const unit_standing_animations = "unit_standing_animations";
ADDPREF(unit_standing_animations)
/** the color of the orb over units that haven't done anything */
static constexpr const char* const unmoved_orb_color = "unmoved_orb_color";
ADDPREF(unmoved_orb_color)
/** whether to lock the FPS to the screen refresh rate */
static constexpr const char* const vsync = "vsync";
ADDPREF(vsync)
/** width of the wesnoth window */
static constexpr const char* const xresolution = "xresolution";
ADDPREF(xresolution)
/** height of the wesnoth window */
static constexpr const char* const yresolution = "yresolution";
ADDPREF(yresolution)
//
// MP alert preferences
// Note, this list of items must match those ids defined in data/gui/dialogs/mp_alerts_options.cfg
//
/** whether to play a sound when a player joins the game you're in */
static constexpr const char* const player_joins_sound = "player_joins_sound";
ADDPREF(player_joins_sound)
/** whether to show a notification when a player joins the game you're in */
static constexpr const char* const player_joins_notif = "player_joins_notif";
ADDPREF(player_joins_notif)
/** whether to show the enabled player join sound or notification in the lobby as well */
static constexpr const char* const player_joins_lobby = "player_joins_lobby";
ADDPREF(player_joins_lobby)
/** whether to play a sound when a player leaves the game you're in */
static constexpr const char* const player_leaves_sound = "player_leaves_sound";
ADDPREF(player_leaves_sound)
/** whether to show a notification when a player leaves the game you're in */
static constexpr const char* const player_leaves_notif = "player_leaves_notif";
ADDPREF(player_leaves_notif)
/** whether to show the enabled player leave sound or notification in the lobby as well */
static constexpr const char* const player_leaves_lobby = "player_leaves_lobby";
ADDPREF(player_leaves_lobby)
/** whether to play a sound when receiving a private message aka whisper */
static constexpr const char* const private_message_sound = "private_message_sound";
ADDPREF(private_message_sound)
/** whether to show a notification when receiving a private message aka whisper */
static constexpr const char* const private_message_notif = "private_message_notif";
ADDPREF(private_message_notif)
/** whether to show the enabled private message aka whisper join sound or notification in the lobby as well */
static constexpr const char* const private_message_lobby = "private_message_lobby";
ADDPREF(private_message_lobby)
/** whether to play a sound when a friend messages you while in game */
static constexpr const char* const friend_message_sound = "friend_message_sound";
ADDPREF(friend_message_sound)
/** whether to show a notification when a friend messages you while in game */
static constexpr const char* const friend_message_notif = "friend_message_notif";
ADDPREF(friend_message_notif)
/** whether to show the enabled friend message sound or notification in the lobby as well */
static constexpr const char* const friend_message_lobby = "friend_message_lobby";
ADDPREF(friend_message_lobby)
/** whether to play a sound when a public message is sent */
static constexpr const char* const public_message_sound = "public_message_sound";
ADDPREF(public_message_sound)
/** whether to show a notification when a public message is sent */
static constexpr const char* const public_message_notif = "public_message_notif";
ADDPREF(public_message_notif)
/** whether to show the enabled public message sound or notification in the lobby as well */
static constexpr const char* const public_message_lobby = "public_message_lobby";
ADDPREF(public_message_lobby)
/** whether to play a sound when a server message is sent */
static constexpr const char* const server_message_sound = "server_message_sound";
ADDPREF(server_message_sound)
/** whether to show a notification when a server message is sent */
static constexpr const char* const server_message_notif = "server_message_notif";
ADDPREF(server_message_notif)
/** whether to show the enabled server message sound or notification in the lobby as well */
static constexpr const char* const server_message_lobby = "server_message_lobby";
ADDPREF(server_message_lobby)
/** whether to play a sound when the game is ready to be started */
static constexpr const char* const ready_for_start_sound = "ready_for_start_sound";
ADDPREF(ready_for_start_sound)
/** whether to show a notification when the game is ready to be started */
static constexpr const char* const ready_for_start_notif = "ready_for_start_notif";
ADDPREF(ready_for_start_notif)
/** used to make a UI element invisible in the mp alerts options dialog */
static constexpr const char* const ready_for_start_lobby = "ready_for_start_lobby";
ADDPREF(ready_for_start_lobby)
/** whether to play a sound when the game has started */
static constexpr const char* const game_has_begun_sound = "game_has_begun_sound";
ADDPREF(game_has_begun_sound)
/** whether to show a notification when the game has started */
static constexpr const char* const game_has_begun_notif = "game_has_begun_notif";
ADDPREF(game_has_begun_notif)
/** used to make a UI element invisible in the mp alerts options dialog */
static constexpr const char* const game_has_begun_lobby = "game_has_begun_lobby";
ADDPREF(game_has_begun_lobby)
/** used to make a UI element invisible in the mp alerts options dialog */
static constexpr const char* const turn_changed_sound = "turn_changed_sound";
ADDPREF(turn_changed_sound)
/** whether to show a notification when the turn changes */
static constexpr const char* const turn_changed_notif = "turn_changed_notif";
ADDPREF(turn_changed_notif)
/** used to make a UI element invisible in the mp alerts options dialog */
static constexpr const char* const turn_changed_lobby = "turn_changed_lobby";
ADDPREF(turn_changed_lobby)
/** whether to play a sound when a new game is created */
static constexpr const char* const game_created_sound = "game_created_sound";
ADDPREF(game_created_sound)
/** whether to show a notification when a new game is created */
static constexpr const char* const game_created_notif = "game_created_notif";
ADDPREF(game_created_notif)
/** whether to show the new game creation message sound or notification in the lobby as well */
static constexpr const char* const game_created_lobby = "game_created_lobby";
ADDPREF(game_created_lobby)
//
// advanced preferences
// these are also set via the preferences dialog without using their explicit setter methods
//
/** whether to show a confirmation dialog for deleting save files */
static constexpr const char* const ask_delete = "ask_delete";
ADDPREF(ask_delete)
/** how many minutes to wait before removing chat messages */
static constexpr const char* const chat_message_aging = "chat_message_aging";
ADDPREF(chat_message_aging)
/** whether to use a color cursor */
static constexpr const char* const color_cursors = "color_cursors";
ADDPREF(color_cursors)
/** what compression to use for save files, if any */
static constexpr const char* const compress_saves = "compress_saves";
ADDPREF(compress_saves)
/** whether to ask for confirmation when loading a save from a different version of wesnoth */
static constexpr const char* const confirm_load_save_from_different_version = "confirm_load_save_from_different_version";
ADDPREF(confirm_load_save_from_different_version)
/** whether to use monte carlo instead of exact calculations for fight outcomes */
static constexpr const char* const damage_prediction_allow_monte_carlo_simulation = "damage_prediction_allow_monte_carlo_simulation";
ADDPREF(damage_prediction_allow_monte_carlo_simulation)
/** how many recent files to keep a list of */
static constexpr const char* const editor_max_recent_files = "editor_max_recent_files";
ADDPREF(editor_max_recent_files)
/** additional scaling for text on top of the pixel scale multiplier */
static constexpr const char* const font_scale = "font_scale";
ADDPREF(font_scale)
/** how long to wait before assuming a connection to the multiplayer server has been lost */
static constexpr const char* const keepalive_timeout = "keepalive_timeout";
ADDPREF(keepalive_timeout)
/** whether to open a new chat tab in the multiplayer lobby after sending a whisper */
static constexpr const char* const lobby_auto_open_whisper_windows = "lobby_auto_open_whisper_windows";
ADDPREF(lobby_auto_open_whisper_windows)
/** whether holding middle click and moving the mouse will scroll around the map */
static constexpr const char* const middle_click_scrolls = "middle_click_scrolls";
ADDPREF(middle_click_scrolls)
/** whether moving the mouse to the sides of the window scrolls around the map */
static constexpr const char* const mouse_scrolling = "mouse_scrolling";
ADDPREF(mouse_scrolling)
/** whether to scroll to a unit when an action is taken */
static constexpr const char* const scroll_to_action = "scroll_to_action";
ADDPREF(scroll_to_action)
/** keep scrolling when the mouse moves outside the wesnoth window */
static constexpr const char* const scroll_when_mouse_outside = "scroll_when_mouse_outside";
ADDPREF(scroll_when_mouse_outside)
/** whether to show all units in the help rather than only the units encountered so far */
static constexpr const char* const show_all_units_in_help = "show_all_units_in_help";
ADDPREF(show_all_units_in_help)
/** whether to show combat animations */
static constexpr const char* const show_combat = "show_combat";
ADDPREF(show_combat)
/** whether to show deprecation warnings for WML, lua, etc APIs */
static constexpr const char* const show_deprecation = "show_deprecation";
ADDPREF(show_deprecation)
/** whether to use a 12 hour vs 24 hours clock in various places on the UI */
static constexpr const char* const use_twelve_hour_clock_format = "use_twelve_hour_clock_format";
ADDPREF(use_twelve_hour_clock_format)
ENUM_AND_ARRAY(
_last_cache_cleaned_ver,

View file

@ -524,7 +524,7 @@ void close_sound()
void reset_sound()
{
bool music = prefs::get().music_on();
bool sound = prefs::get().sound_on();
bool sound = prefs::get().sound();
bool UI_sound = prefs::get().ui_sound_on();
bool bell = prefs::get().turn_bell();
@ -1034,14 +1034,14 @@ static void play_sound_internal(const std::string& files,
void play_sound(const std::string& files, channel_group group, unsigned int repeats)
{
if(prefs::get().sound_on()) {
if(prefs::get().sound()) {
play_sound_internal(files, group, repeats);
}
}
void play_sound_positioned(const std::string& files, int id, int repeats, unsigned int distance)
{
if(prefs::get().sound_on()) {
if(prefs::get().sound()) {
play_sound_internal(files, SOUND_SOURCES, repeats, distance, id);
}
}
@ -1057,7 +1057,7 @@ void play_bell(const std::string& files)
// Play timer with separate volume setting
void play_timer(const std::string& files, int loop_ticks, int fadein_ticks)
{
if(prefs::get().sound_on()) {
if(prefs::get().sound()) {
play_sound_internal(files, SOUND_TIMER, 0, 0, -1, loop_ticks, fadein_ticks);
}
}

View file

@ -722,7 +722,7 @@ static int do_gameloop(commandline_options& cmdline_opts)
#endif
gui2::init();
gui2::switch_theme(prefs::get().gui_theme());
gui2::switch_theme(prefs::get().gui2_theme());
const gui2::event::manager gui_event_manager;
// if the log directory is not writable, then this is the error condition so show the error message.
@ -902,7 +902,7 @@ static int do_gameloop(commandline_options& cmdline_opts)
case gui2::dialogs::title_screen::REDRAW_BACKGROUND:
break;
case gui2::dialogs::title_screen::RELOAD_UI:
gui2::switch_theme(prefs::get().gui_theme());
gui2::switch_theme(prefs::get().gui2_theme());
break;
}
}

View file

@ -314,7 +314,7 @@ void manager::on_init_side()
wait_for_side_init_ = false;
LOG_WB << "on_init_side()";
if (self_activate_once_ && prefs::get().enable_whiteboard_mode_on_start())
if (self_activate_once_ && prefs::get().enable_planning_mode_on_start())
{
self_activate_once_ = false;
set_active(true);