29 #define ERR_NG LOG_STREAM(err, log_engine)
30 #define WRN_NG LOG_STREAM(warn, log_engine)
31 #define LOG_NG LOG_STREAM(info, log_engine)
32 #define DBG_NG LOG_STREAM(debug, log_engine)
34 using namespace std::chrono_literals;
41 , version(cfg[
"version"])
43 , campaign_define(cfg[
"campaign_define"])
44 , campaign_xtra_defines(
utils::
split(cfg[
"campaign_extra_defines"]))
45 , scenario_define(cfg[
"scenario_define"])
46 , era_define(cfg[
"era_define"])
47 , mod_defines(
utils::
split(cfg[
"mod_defines"]))
48 , active_mods(
utils::
split(cfg[
"active_mods"]))
49 , era_id(cfg[
"era_id"])
50 , campaign(cfg[
"campaign"])
51 , campaign_name(cfg[
"campaign_name"])
52 , abbrev(cfg[
"abbrev"])
53 , end_credits(cfg[
"end_credits"].to_bool(true))
54 , end_text(cfg[
"end_text"])
55 , end_text_duration(std::clamp(
chrono::
parse_duration(cfg[
"end_text_duration"], 0ms), 0ms, 5000ms))
57 , random_mode(cfg[
"random_mode"])
58 , oos_debug(cfg[
"oos_debug"].to_bool(false))
92 return campaign.empty() ? campaign_type::multiplayer : campaign_type::scenario;
96 return campaign_type::scenario;
105 struct modevents_entry
107 modevents_entry(
const std::string& _type,
const std::string& _id)
121 std::list<modevents_entry> mods;
122 std::set<std::string> loaded_resources;
123 std::set<std::string> res;
126 mods.emplace_back(
"modification", mod);
135 mods.emplace_back(
"era",
era_id);
139 mods.emplace_back(
"campaign",
campaign);
141 while(!mods.empty()) {
143 const modevents_entry& current = mods.front();
144 if(current.type ==
"resource") {
145 if(!loaded_resources.insert(current.id).second) {
151 if(!cfg[
"addon_id"].empty()) {
152 res.insert(cfg[
"addon_id"]);
155 mods.emplace_back(
"resource", load_res[
"id"].str());
158 ERR_NG <<
"Unable to find config for content " << current.id <<
" of type " << current.type;
163 DBG_NG <<
"Active content for game set to:";
164 for(
const std::string& mod : res) {
A config object defines a single node in a WML file, with access to child nodes.
child_itors child_range(config_key_type key)
std::vector< std::string > campaign_xtra_defines
more customization of data
std::vector< std::string > mod_defines
If there are defines the modifications use to customize data.
std::set< std::string > active_addons(const std::string &scenario_id) const
std::string scenario_define
If there is a define the scenario uses to customize data.
std::string difficulty
The difficulty level the game is being played on.
std::string era_define
If there is a define the era uses to customize data.
std::chrono::milliseconds end_text_duration
for how long the end-of-campaign text is shown
game_classification()=default
std::vector< std::string > active_mods
bool end_credits
whether to show the standard credits at the end
std::string label
Name of the game (e.g.
std::string campaign_define
If there is a define the campaign uses to customize data.
std::string get_tagname() const
std::string campaign
The id of the campaign being played.
std::string abbrev
the campaign abbreviation
bool is_multiplayer() const
std::string end_text
end-of-campaign text
std::string campaign_name
The name of the campaign being played.
static game_config_manager * get()
std::string str() const
Serializes the version number into string form.
Definitions for the interface to Wesnoth Markup Language (WML).
const std::string DEFAULT_DIFFICULTY("NORMAL")
The default difficulty setting for campaigns.
static lg::log_domain log_engine("engine")
Interfaces for manipulating version numbers of engine, add-ons, etc.
std::string label
What to show in the filter's drop-down list.
std::string id
Text to match against addon_info.tags()
Standard logging facilities (interface).
auto parse_duration(const config_attribute_value &val, const Duration &def=Duration{0})
Game configuration data as global variables.
const version_info wesnoth_version(VERSION)
std::string join(const T &v, const std::string &s=",")
Generates a new string joining container items in a list.
std::vector< std::string > split(const config_attribute_value &val)
The base template for associating string values with enum values.
static std::string get_string(enum_type key)
Converts a enum to its string equivalent.