25 #define ERR_ADV LOG_STREAM(err, advanced_preferences)
29 static std::unique_ptr<preferences::advanced_manager>
singleton =
nullptr;
36 prefs.emplace_back(pref);
37 }
catch(
const std::invalid_argument&
e) {
46 if(op.field ==
"show_deprecation") {
47 op.cfg[
"default"] =
true;
53 [](
const auto& lhs,
const auto& rhs) { return translation::icompare(lhs.name, rhs.name) < 0; });
62 , name(pref[
"name"].t_str())
63 , description(pref[
"description"].t_str())
64 , field(pref[
"field"].str())
67 const std::string p_type =
cfg[
"type"];
69 if(p_type ==
"boolean") {
71 }
else if(p_type ==
"int") {
73 }
else if(p_type ==
"combo") {
75 }
else if(p_type ==
"custom") {
78 throw std::invalid_argument(
"Unknown type '" + p_type +
"' for advanced preference " +
name);
84 singleton = std::make_unique<advanced_manager>(gc);
89 assert(
singleton &&
"Advanced preference manager singleton is null!");
static lg::log_domain advanced_preferences("advanced_preferences")
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 ...
config_array_view child_range(config_key_type key) const
advanced_manager(const game_config_view &gc)
Interfaces for manipulating version numbers of engine, add-ons, etc.
Standard logging facilities (interface).
const version_info wesnoth_version(VERSION)
Modify, read and display user preferences.
std::vector< advanced_manager::option > advanced_pref_list
static std::unique_ptr< preferences::advanced_manager > singleton
void init_advanced_manager(const game_config_view &gc)
Initializes the manager singleton.
const advanced_pref_list & get_advanced_preferences()
Gets a list of the available advanced preferences.
option(const config &pref)
config cfg
The full config, including type-specific options.
avd_type type
The preference type.
t_string name
Displayed name.