36 std::map<std::string, std::vector<std::string>> images_campaigns;
37 std::vector<std::string> images_general;
39 void gather_images(
const config& from, std::vector<std::string>& to)
42 to.insert(to.end(), im.begin(), im.end());
52 if(is_campaign_credits) {
54 header = cfg[
"name"].t_str();
60 if(!
about.has_child(
"entry")) {
66 if(is_campaign_credits) {
67 gather_images(
about, images_campaigns[
id]);
69 gather_images(
about, images_general);
73 if(cfg[
"sort"].to_bool(
false)) {
80 , title(cfg[
"title"].t_str())
96 return parsed_credits_data;
101 const credits_data::const_iterator res = std::find_if(parsed_credits_data.begin(), parsed_credits_data.end(),
102 [&campaign](
const credits_group& group) { return group.id == campaign; });
103 return res != parsed_credits_data.end() ? utils::make_optional(res) : utils::nullopt;
108 if(campaign.empty()) {
109 return images_general;
112 if(
const auto it = images_campaigns.find(campaign); it != images_campaigns.cend()) {
116 return images_general;
121 parsed_credits_data.clear();
125 images_campaigns.clear();
126 images_general.clear();
132 if(group.has_child(
"about")) {
133 parsed_credits_data.emplace_back(group,
false);
137 gather_images(group, images_general);
150 parsed_credits_data.emplace_back(misc,
false);
157 if(campaign.has_child(
"about")) {
158 parsed_credits_data.emplace_back(campaign,
true);
std::vector< std::string > names
A config object defines a single node in a WML file, with access to child nodes.
std::size_t child_count(config_key_type key) const
child_itors child_range(config_key_type key)
config & add_child(config_key_type key)
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
const std::string & str() const
Definitions for the interface to Wesnoth Markup Language (WML).
std::string id
Text to match against addon_info.tags()
Display credits about all contributors.
std::vector< credits_group > credits_data
utils::optional< credits_data::const_iterator > get_campaign_credits(const std::string &campaign)
Gets credits for a given campaign.
void set_about(const game_config_view &cfg)
Regenerates the credits data.
std::vector< std::string > get_background_images(const std::string &campaign)
Gets credit background images for a given campaign.
const credits_data & get_credits_data()
Gets all credits data.
std::string escape_text(std::string_view text)
Escapes the pango markup characters in a text.
int compare(const std::string &s1, const std::string &s2)
Case-sensitive lexicographical comparison.
std::vector< std::string > parenthetical_split(std::string_view val, const char separator, std::string_view left, std::string_view right, const int flags)
Splits a string based either on a separator, except then the text appears within specified parenthesi...
about_group(const config &cfg)
bool operator<(const about_group &o) const
std::vector< std::pair< std::string, std::string > > names
Contributor names.
t_string title
The section title.
t_string header
Optional group title.
credits_group(const config &cfg, bool is_campaign_credits)
std::vector< about_group > sections
The group's sub-groups.