48 #include <boost/algorithm/string.hpp>
56 #define WRN_HP LOG_STREAM(warn, log_help)
57 #define DBG_HP LOG_STREAM(debug, log_help)
103 if (ch < 0x2e80)
return false;
107 (ch >= 0x4e00 && ch < 0x9fcf) ||
108 (ch >= 0x3400 && ch < 0x4dbf) ||
109 (ch >= 0x20000 && ch < 0x2a6df) ||
110 (ch >= 0xf900 && ch < 0xfaff) ||
111 (ch >= 0x3190 && ch < 0x319f) ||
114 (ch >= 0x2e80 && ch < 0x2eff) ||
115 (ch >= 0x2f00 && ch < 0x2fdf) ||
116 (ch >= 0x31c0 && ch < 0x31ef) ||
119 (ch >= 0x3104 && ch < 0x312e) ||
120 (ch >= 0x31a0 && ch < 0x31bb) ||
123 (ch >= 0xa490 && ch < 0xa4c7) ||
124 (ch >= 0xa000 && ch < 0xa48d) ||
127 (ch >= 0x3040 && ch <= 0x309f) ||
128 (ch >= 0x30a0 && ch <= 0x30ff) ||
129 (ch >= 0x1b000 && ch <= 0x1b001) ||
132 (ch >= 0x31f0 && ch <= 0x31ff) ||
135 (ch >= 0xac00 && ch < 0xd7af) ||
136 (ch >= 0x1100 && ch <= 0x11ff) ||
137 (ch >= 0xa960 && ch <= 0xa97c) ||
138 (ch >= 0xd7b0 && ch <= 0xd7fb) ||
141 (ch >= 0x3000 && ch < 0x303f) ||
144 (ch >= 0xff00 && ch < 0xffef);
151 const std::vector<std::string> toplevel_refs
153 if (
std::find(toplevel_refs.begin(), toplevel_refs.end(), section_id)
154 != toplevel_refs.end()) {
161 const std::vector<std::string> sections_refd
163 if (
std::find(sections_refd.begin(), sections_refd.end(), section_id)
164 != sections_refd.end()) {
175 const std::vector<std::string> toplevel_refs
177 if (
std::find(toplevel_refs.begin(), toplevel_refs.end(), topic_id)
178 != toplevel_refs.end()) {
185 const std::vector<std::string> topics_refd
187 if (
std::find(topics_refd.begin(), topics_refd.end(), topic_id)
188 != topics_refd.end()) {
199 PLAIN_LOG <<
"Maximum section depth has been reached. Maybe circular dependency?";
201 else if (section_cfg !=
nullptr) {
203 std::string
id =
level == 0 ?
"toplevel" : (*section_cfg)[
"id"].str();
206 std::stringstream ss;
207 ss <<
"Invalid ID, used for internal purpose: '" <<
id <<
"'";
211 std::string title =
level == 0 ?
"" : (*section_cfg)[
"title"].str();
215 for(
const std::string& sec_id : sections) {
216 if (
auto child_cfg = help_cfg->
find_child(
"section",
"id", sec_id))
223 std::stringstream ss;
224 ss <<
"Help-section '" << sec_id <<
"' referenced from '"
225 <<
id <<
"' but could not be found.";
231 if ((*section_cfg)[
"sort_sections"] ==
"yes") {
235 bool sort_topics =
false;
236 bool sort_generated =
true;
238 if ((*section_cfg)[
"sort_topics"] ==
"yes") {
240 sort_generated =
false;
241 }
else if ((*section_cfg)[
"sort_topics"] ==
"no") {
243 sort_generated =
false;
244 }
else if ((*section_cfg)[
"sort_topics"] ==
"generated") {
246 sort_generated =
true;
247 }
else if (!(*section_cfg)[
"sort_topics"].empty()) {
248 std::stringstream ss;
249 ss <<
"Invalid sort option: '" << (*section_cfg)[
"sort_topics"] <<
"'";
253 std::vector<topic> generated_topics =
generate_topics(sort_generated,(*section_cfg)[
"generator"]);
254 std::vector<topic> topics;
258 if (
auto topic_cfg = help_cfg->
find_child(
"topic",
"id", topic_id))
260 std::string text = topic_cfg[
"text"];
262 topic child_topic(topic_cfg[
"title"], topic_cfg[
"id"], text);
264 std::stringstream ss;
265 ss <<
"Invalid ID, used for internal purpose: '" <<
id <<
"'";
268 topics.push_back(child_topic);
271 std::stringstream ss;
272 ss <<
"Help-topic '" << topic_id <<
"' referenced from '" <<
id
273 <<
"' but could not be found." << std::endl;
279 std::sort(topics.begin(),topics.end(),
title_less());
280 std::sort(generated_topics.begin(),
282 std::merge(generated_topics.begin(),
283 generated_topics.end(),topics.begin(),topics.end()
288 topics.begin(), topics.end());
290 generated_topics.begin(), generated_topics.end());
298 if (cfg !=
nullptr) {
307 std::vector<topic> res;
314 }
else if (
generator ==
"weapon_specials") {
316 }
else if (
generator ==
"time_of_days") {
322 if (parts.size() > 1 && parts[0] ==
"units") {
324 }
else if (parts[0] ==
"era" && parts.size()>1) {
327 WRN_HP <<
"Found a topic generator that I didn't recognize: " <<
generator;
341 DBG_HP <<
"Generating eras...";
345 if (parts.size() > 1 && parts[0] ==
"units") {
348 WRN_HP <<
"Found a section generator that I didn't recognize: " <<
generator;
355 std::string empty_string =
"";
360 if (parts.size() > 1 && parts[0] ==
"contents") {
361 if (parts[1] ==
"generated") {
389 return markup::span_color((time_of_day_bonus > 0 ?
"green" : (time_of_day_bonus < 0 ?
"red" :
"white")), time_of_day_bonus);
394 std::vector<topic> topics;
395 std::stringstream toplevel;
398 toplevel <<
_(
"Only available during a scenario.");
399 topics.emplace_back(
_(
"Time of Day Schedule"),
"..schedule", toplevel.str());
406 const std::string
id =
"time_of_day_" + time.id;
408 const std::string image_lawful =
markup::img(
"icons/alignments/alignment_lawful_30.png");
409 const std::string image_neutral =
markup::img(
"icons/alignments/alignment_neutral_30.png");
410 const std::string image_chaotic =
markup::img(
"icons/alignments/alignment_chaotic_30.png");
411 const std::string image_liminal =
markup::img(
"icons/alignments/alignment_liminal_30.png");
412 std::stringstream text, row_ss;
427 text <<
image <<
'\n'
428 << time.description.str() <<
'\n'
435 topics.emplace_back(time.name.str(),
id, text.str());
438 topics.emplace_back(
_(
"Time of Day Schedule"),
"..schedule",
markup::tag(
"table", toplevel.str()));
444 std::vector<topic> topics;
446 std::map<t_string, std::string> special_description;
447 std::map<t_string, std::set<std::string, string_less>> special_units;
456 for(
const auto& [name, description] : atk.special_tooltips()) {
457 special_description.emplace(name, description);
459 if (!
type.hide_help()) {
461 std::string type_name =
type.type_name();
463 const std::string section_prefix =
type.show_variations_in_help() ?
".." :
"";
468 special_units[name].insert(link);
473 for(
const config& adv :
type.modification_advancements()) {
475 if(effect[
"apply_to"] ==
"new_attack" && effect.has_child(
"specials")) {
476 for(
const auto [key, special] : effect.mandatory_child(
"specials").all_children_view()) {
477 if(!special[
"name"].empty()) {
478 special_description.emplace(special[
"name"].t_str(), special[
"description"].t_str());
479 if(!
type.hide_help()) {
481 std::string type_name =
type.type_name();
483 const std::string section_prefix =
type.show_variations_in_help() ?
".." :
"";
488 special_units[special[
"name"]].insert(link);
492 }
else if(effect[
"apply_to"] ==
"attack" && effect.has_child(
"set_specials")) {
493 for(
const auto [key, special] : effect.mandatory_child(
"set_specials").all_children_view()) {
494 if(!special[
"name"].empty()) {
495 special_description.emplace(special[
"name"].t_str(), special[
"description"].t_str());
496 if(!
type.hide_help()) {
498 std::string type_name =
type.type_name();
500 const std::string section_prefix =
type.show_variations_in_help() ?
".." :
"";
505 special_units[special[
"name"]].insert(link);
514 for(
const auto& [name, description] : special_description) {
516 std::string
id =
"weaponspecial_" + name.base_str();
517 std::stringstream text;
519 text <<
"\n\n" <<
markup::tag(
"header",
_(
"Units with this special attack")) <<
"\n";
520 for(
const std::string& type_id : special_units[name]) {
524 topics.emplace_back(name,
id, text.str());
528 std::sort(topics.begin(), topics.end(),
title_less());
534 std::vector<topic> topics;
536 std::map<std::string, const unit_type::ability_metadata*> ability_topic_data;
537 std::map<std::string, std::set<std::string, string_less>> ability_units;
544 const std::string topic_ref = ability.id + ability.name.base_str();
546 ability_topic_data.emplace(topic_ref, &ability);
548 if(!
type.hide_help()) {
553 ability_units[topic_ref].insert(link);
566 parse(
type, ability);
570 parse(
type, ability);
574 for(
const auto& a : ability_topic_data) {
575 if (a.second->name.empty()) {
578 std::ostringstream text;
579 text << a.second->description;
580 text <<
"\n\n" <<
markup::tag(
"header",
_(
"Units with this ability")) <<
"\n";
582 for(
const auto& u : ability_units[a.first]) {
586 topics.emplace_back(a.second->name,
ability_prefix + a.first, text.str());
590 std::sort(topics.begin(), topics.end(),
title_less());
598 std::vector<topic> topics;
601 if(era && !era[
"hide_help"].to_bool()) {
604 std::vector<std::string> faction_links;
605 for (
const topic &
t : topics) {
609 std::stringstream text;
611 if (!description.
empty()) {
612 text << description.
t_str() <<
"\n";
618 std::sort(faction_links.begin(), faction_links.end());
619 for (
const std::string &link : faction_links) {
623 topic era_topic(era[
"name"],
".." +
era_prefix + era[
"id"].str(), text.str());
625 topics.push_back( era_topic );
632 std::vector<topic> topics;
634 const std::string&
id =
f[
"id"];
638 std::stringstream text;
641 if (!description.
empty()) {
642 text << description.
t_str() <<
"\n";
646 const std::vector<std::string> recruit_ids =
utils::split(
f[
"recruit"]);
647 std::set<std::string> races;
648 std::set<std::string> alignments;
650 for (
const std::string & u_id : recruit_ids) {
662 if (!races.empty()) {
664 text <<
_(
"Races: ") << *(it++);
665 while(it != races.end()) {
666 text <<
", " << *(it++);
671 if (!alignments.empty()) {
673 text <<
_(
"Alignments: ") << *(it++);
674 while(it != alignments.end()) {
675 text <<
", " << *(it++);
681 const std::vector<std::string> leaders =
683 for (
const std::string &link : leaders) {
690 const std::vector<std::string> recruit_links =
692 for (
const std::string &link : recruit_links) {
696 const std::string name =
f[
"name"];
698 topics.emplace_back(name, ref_id, text.str());
701 std::sort(topics.begin(), topics.end(),
title_less());
710 std::map<std::string, const config> trait_list;
714 trait_list.emplace(trait[
"id"], trait);
718 std::set<std::string> races;
729 races.insert(
type.race_id());
739 for (
const config& trait :
type.possible_traits()) {
740 trait_list.emplace(trait[
"id"], trait);
750 for(
const auto& race_id : races) {
752 for(
const config & trait : r->additional_traits()) {
753 trait_list.emplace(trait[
"id"], trait);
758 std::vector<topic> topics;
759 for(
auto& a : trait_list) {
760 std::string
id =
"traits_" + a.first;
761 const config& trait = a.second;
763 std::string name = trait[
"male_name"].str();
764 if (name.empty()) name = trait[
"female_name"].str();
765 if (name.empty()) name = trait[
"name"].str();
766 if (name.empty())
continue;
768 std::stringstream text;
769 if (!trait[
"help_text"].empty()) {
770 text << trait[
"help_text"];
771 }
else if (!trait[
"description"].empty()) {
772 text << trait[
"description"];
774 text <<
_(
"No description available.");
778 topics.emplace_back(name,
id, text.str());
782 std::sort(topics.begin(), topics.end(),
title_less());
793 PLAIN_LOG <<
"Unknown unit type : " << type_id;
797 }
else if (!
type->hide_help()) {
798 std::string name =
type->type_name();
801 const std::string section_prefix =
type->show_variations_in_help() ?
".." :
"";
815 std::vector<std::string> links_list;
816 for (
const std::string &type_id : type_id_list) {
818 if (!unit_link.empty())
819 links_list.push_back(unit_link);
823 std::sort(links_list.begin(), links_list.end());
830 std::set<std::string, string_less> races;
831 std::set<std::string, string_less> visible_races;
838 races.insert(
type.race_id());
839 if(!
type.hide_help())
840 visible_races.insert(
type.race_id());
845 std::set<std::string, string_less> last_sweep = visible_races;
846 while(!last_sweep.empty()) {
847 std::set<std::string, string_less> current_sweep;
848 for(
const auto& race_id : last_sweep) {
850 const auto& help_taxonomy = r->help_taxonomy();
851 if(!help_taxonomy.empty() && !visible_races.count(help_taxonomy) &&
unit_types.
find_race(help_taxonomy)) {
852 current_sweep.insert(help_taxonomy);
853 races.insert(help_taxonomy);
854 visible_races.insert(help_taxonomy);
858 last_sweep = std::move(current_sweep);
861 struct taxonomy_queue_type
863 std::string parent_id;
866 std::vector<taxonomy_queue_type> taxonomy_queue;
870 for(
const auto& race_id : races) {
874 bool hidden = (visible_races.count(race_id) == 0);
879 std::string help_taxonomy;
881 title = r->plural_name();
882 help_taxonomy = r->help_taxonomy();
884 title =
_(
"race^Miscellaneous");
887 section_cfg[
"title"] = title;
889 section_cfg[
"sections_generator"] =
"units:" + race_id;
890 section_cfg[
"generator"] =
"units:" + race_id;
894 if(help_taxonomy.empty()) {
897 bool parent_hidden = (visible_races.count(help_taxonomy) == 0);
899 taxonomy_queue.push_back({std::move(parent_id), std::move(race_section)});
904 bool process_queue_again =
true;
905 while(process_queue_again && !taxonomy_queue.empty()) {
906 process_queue_again =
false;
907 auto to_process = std::exchange(taxonomy_queue, {});
909 for(
auto& x : to_process) {
912 parent->add_section(x.content);
913 process_queue_again =
true;
915 taxonomy_queue.push_back(std::move(x));
921 for(
auto& x : taxonomy_queue) {
929 if (era[
"hide_help"].to_bool()) {
933 DBG_HP <<
"Adding help section: " << era[
"id"].str();
937 section_cfg[
"id"] =
era_prefix + era[
"id"].str();
938 section_cfg[
"title"] = era[
"name"];
940 section_cfg[
"generator"] =
"era:" + era[
"id"].str();
954 WRN_HP <<
"When building terrain help sections, couldn't acquire terrain types data, aborting.";
958 std::map<std::string, section> base_map;
966 bool hidden =
info.hide_help();
969 ==
prefs::get().encountered_terrains().end() && !
info.is_overlay())
973 terrain_topic.
title =
info.editor_name();
975 terrain_topic.
text = std::make_shared<terrain_topic_generator>(
info);
978 if (
info.has_default_base()) {
979 for (
const auto base : tdata->underlying_union_terrain(
info.default_base())) {
981 base_terrains.emplace_back(base);
987 const terrain_type& base_info = tdata->get_terrain_info(base);
992 section& base_section = base_map[base_info.
id()];
997 if (base_info.
id() ==
info.id())
999 base_section.
topics.push_back(terrain_topic);
1003 for (
const auto& base : base_map) {
1010 for (
const unit_type_data::unit_type_map::value_type &
i :
unit_types.
types()) {
1013 if (
type.race_id() != race)
1016 if (!
type.show_variations_in_help())
1020 for (
const std::string &variation_id :
type.variations()) {
1022 const unit_type &var_type =
type.get_variation(variation_id);
1026 topic var_topic(topic_name, var_ref,
"");
1027 var_topic.
text = std::make_shared<unit_topic_generator>(var_type, variation_id);
1028 base_unit.
topics.push_back(var_topic);
1031 const std::string type_name =
type.type_name();
1034 base_unit.
id = ref_id;
1035 base_unit.
title = type_name;
1043 std::vector<topic> topics;
1044 std::set<std::string, string_less> race_units;
1045 std::set<std::string, string_less> race_topics;
1046 std::set<std::string> alignments;
1048 for (
const unit_type_data::unit_type_map::value_type &
i :
unit_types.
types())
1052 if (
type.race_id() != race)
1060 const std::string type_name =
type.type_name() + (
type.id() ==
type.type_name().str() ?
"" : debug_suffix);
1061 const std::string real_prefix =
type.show_variations_in_help() ?
".." :
"";
1063 topic unit_topic(type_name, ref_id,
"");
1064 unit_topic.
text = std::make_shared<unit_topic_generator>(
type);
1065 topics.push_back(unit_topic);
1067 if (!
type.hide_help()) {
1071 race_units.insert(link);
1078 std::string race_id =
"..race_"+race;
1079 std::string race_name;
1080 std::string race_description;
1081 std::string race_help_taxonomy;
1083 race_name = r->plural_name();
1084 race_description = r->description();
1085 race_help_taxonomy = r->help_taxonomy();
1087 for (
const config &additional_topic : r->additional_topics())
1089 std::string
id = additional_topic[
"id"];
1090 std::string title = additional_topic[
"title"];
1091 std::string text = additional_topic[
"text"];
1093 topics.emplace_back(title,
id,text);
1095 race_topics.insert(link);
1098 race_name =
_ (
"race^Miscellaneous");
1103 std::map<std::string, t_string> subgroups;
1105 if (r.second.help_taxonomy() == race) {
1106 if (!r.second.plural_name().empty())
1107 subgroups[r.first] = r.second.plural_name();
1109 subgroups[r.first] = r.first;
1113 std::stringstream text;
1115 if (!race_description.empty()) {
1116 text << race_description <<
"\n\n";
1119 if (!alignments.empty()) {
1121 text << (alignments.size() > 1 ?
_(
"Alignments: ") :
_(
"Alignment: ")) << *(it++);
1122 while(it != alignments.end()) {
1123 text <<
", " << *(it++);
1128 if (!race_help_taxonomy.empty()) {
1130 symbols[
"topic_id"] =
"..race_"+race_help_taxonomy;
1132 symbols[
"help_taxonomy"] = r->plural_name();
1136 symbols[
"help_taxonomy"] = race_help_taxonomy;
1140 text <<
VGETTEXT(
"This is a group of units, all of whom are <ref dst='$topic_id'>$help_taxonomy</ref>.", symbols) <<
"\n\n";
1143 if (!subgroups.empty()) {
1144 if (!race_help_taxonomy.empty()) {
1145 text <<
markup::tag(
"header",
_(
"Subgroups of units within this group")) <<
"\n";
1147 text <<
markup::tag(
"header",
_(
"Groups of units within this race")) <<
"\n";
1149 for (
const auto &sg : subgroups) {
1155 if (!race_help_taxonomy.empty()) {
1156 text <<
markup::tag(
"header",
_(
"Units of this group")) <<
"\n";
1158 text <<
markup::tag(
"header",
_(
"Units of this race")) <<
"\n";
1160 for (
const auto &u : race_units) {
1164 topics.emplace_back(race_name, race_id, text.str());
1167 std::sort(topics.begin(), topics.end(),
title_less());
1180 if (encountered_units.find(
type.id()) != encountered_units.end()) {
1185 if (
type.id() ==
"Fog Clearer") {
1194 auto section_cfg = help_cfg->
find_child(
"section",
"id", section_name);
1196 return std::string();
1199 std::ostringstream res;
1204 typedef std::pair<std::string,std::string> link;
1205 std::vector<link> topics_links;
1208 for(
const std::string&
topic : topics) {
1210 std::string
id = topic_cfg[
"id"];
1212 topics_links.emplace_back(topic_cfg[
"title"],
id);
1216 if (section_cfg[
"sort_topics"] ==
"yes") {
1217 std::sort(topics_links.begin(),topics_links.end());
1220 for(
const auto& [text, target] : topics_links) {
1230 std::stringstream res;
1260 return sec.
id ==
id;
1281 topic_list::const_iterator tit =
1283 if (tit != sec.
topics.end()) {
1302 for (
const auto &subsection : sec.
sections) {
1318 if (text.length() > 0 && text[0] ==
' ') {
1319 return text.substr(1);
1326 std::size_t first_word_start =
s.find_first_not_of(
' ');
1327 if (first_word_start == std::string::npos) {
1330 std::size_t first_word_end =
s.find_first_of(
" \n", first_word_start);
1331 if( first_word_end == first_word_start ) {
1333 first_word_end = first_word_start+1;
1337 std::string re =
s.substr(0, first_word_end);
1343 char32_t firstchar = *ch;
1345 re = unicode_cast<std::string>(firstchar);
1365 std::stringstream ss;
1368 const std::string
id =
section[
"id"];
1374 if (!ss.str().empty()) {
1381 hidden_toplevel[
"sections"] = ss.str();
1385 const std::string
id =
topic[
"id"];
1388 if (!ss.str().empty()) {
1395 hidden_toplevel[
"topics"] = ss.str();
1396 config hidden_cfg = *help_config;
1399 hidden_cfg.
add_child(
"toplevel", std::move(hidden_toplevel));
1403 std::stringstream
msg;
1404 msg <<
"Parse error when parsing help text: '" <<
e.message <<
"'";
1412 return (hidden ?
"." :
"");
1416 return (
id.empty() ||
id[0] !=
'.');
1425 if (
id ==
"toplevel") {
1431 if (
id.
compare(0, 8,
"ability_") == 0) {
1434 if (
id.
compare(0, 14,
"weaponspecial_") == 0) {
1437 if (
id ==
"hidden") {
int generic_combat_modifier(int lawful_bonus, unit_alignments::type alignment, bool is_fearless, int max_liminal_bonus)
Returns the amount that a unit's damage should be multiplied by due to a given lawful_bonus.
Various functions that implement attacks and attack calculations.
Variant for storing WML attributes.
bool empty() const
Tests for an attribute that either was never set or was set to "".
A config object defines a single node in a WML file, with access to child nodes.
optional_config_impl< config > find_child(config_key_type key, const std::string &name, const std::string &value)
Returns the first child of tag key with a name attribute containing value.
void clear_children(T... keys)
child_itors child_range(config_key_type key)
std::string debug() const
optional_config_impl< config > optional_child(config_key_type key, int n=0)
Equivalent to mandatory_child, but returns an empty optional if the nth child was not found.
config & add_child(config_key_type key)
static game_config_manager * get()
const std::shared_ptr< terrain_type_data > & terrain_types() const
A class grating read only view to a vector of config objects, viewed as one config with all children ...
const config & child_or_empty(config_key_type key) const
optional_const_config find_child(config_key_type key, const std::string &name, const std::string &value) const
config_array_view child_range(config_key_type key) const
To be used as a function object to locate sections and topics with a specified ID.
To be used as a function object when sorting section lists on the title.
To be used as a function object when sorting topic lists on the title.
The text displayed in a topic.
std::shared_ptr< topic_generator > generator_
topic_text & operator=(topic_text &&t)=default
const config & parsed_text() const
std::set< std::string > & encountered_units()
bool hide_help() const
For instances created from a [terrain_type] tag, the value in the tag (with default false).
bool is_nonnull() const
True if this object represents some sentinel values.
const std::string & id() const
const t_string & editor_name() const
int get_max_liminal_bonus() const
const std::vector< time_of_day > & times(const map_location &loc=map_location::null_location()) const
static iterator_base end(const string_type &str)
const unit_type * find(const std::string &key, unit_type::BUILD_STATUS status=unit_type::FULL) const
Finds a unit_type by its id() and makes sure it is built to the specified level.
const race_map & races() const
const unit_race * find_race(const std::string &) const
const unit_type_map & types() const
config_array_view traits() const
A single unit type that the player may recruit.
const std::string & id() const
The id for this unit_type.
const t_string & variation_name() const
static std::string _(const char *str)
std::string id
Text to match against addon_info.tags()
static lg::log_domain log_help("help")
Standard logging facilities (interface).
const std::string unicode_bullet
std::string get_first_word(const std::string &s)
Return the first word in s, not removing any spaces in the start of it.
std::vector< topic > generate_unit_topics(const bool sort_generated, const std::string &race)
std::string hidden_symbol(bool hidden)
void generate_unit_sections(const config *, section &sec, int, const bool, const std::string &race)
@ HIDDEN_BUT_SHOW_MACROS
Although the unit itself is hidden, traits reachable via this unit are not hidden.
@ NO_DESCRIPTION
Ignore this unit for documentation purposes.
void generate_races_sections(const config *help_cfg, section &sec, int level)
bool topic_is_referenced(const std::string &topic_id, const config &cfg)
Return true if the topic with id topic_id is referenced from another section in the config,...
std::vector< topic > generate_time_of_day_topics(const bool)
int last_num_encountered_units
void generate_terrain_sections(section &sec, int)
std::string make_unit_link(const std::string &type_id)
return a hyperlink with the unit's name and pointing to the unit page return empty string if this uni...
const std::string open_section_img
const std::string unit_prefix
const std::string variation_prefix
void parse_config_internal(const config *help_cfg, const config *section_cfg, section &sec, int level)
Recursive function used by parse_config.
bool is_visible_id(const std::string &id)
const std::string closed_section_img
std::vector< topic > generate_faction_topics(const config &era, const bool sort_generated)
void generate_sections(const config *help_cfg, const std::string &generator, section &sec, int level)
Dispatch generators to their appropriate functions.
const std::string topic_img
UNIT_DESCRIPTION_TYPE description_type(const unit_type &type)
Return the type of description that should be shown for a unit of the given kind.
const std::string race_prefix
const std::string ability_prefix
std::vector< std::string > make_unit_links_list(const std::vector< std::string > &type_id_list, bool ordered)
return a list of hyperlinks to unit's pages (ordered or not)
std::vector< topic > generate_topics(const bool sort_generated, const std::string &generator)
const section * find_section(const section &sec, const std::string &id)
Search for the section with the specified identifier in the section and its subsections.
static std::string time_of_day_bonus_colored(const int time_of_day_bonus)
const int normal_font_size
void generate_contents()
Generate the help contents from the configurations given to the manager.
const std::string terrain_prefix
std::vector< topic > generate_weapon_special_topics(const bool sort_generated)
std::vector< topic > generate_ability_topics(const bool sort_generated)
std::string remove_first_space(const std::string &text)
const std::string unknown_unit_topic
const int max_section_level
const unsigned max_history
std::vector< std::string > empty_string_vector
bool section_is_referenced(const std::string §ion_id, const config &cfg)
Return true if the section with id section_id is referenced from another section in the config,...
std::shared_ptr< terrain_type_data > load_terrain_types_data()
Load the appropriate terrain types data to use.
bool is_valid_id(const std::string &id)
Return true if the id is valid for user defined topics and sections.
boost::tribool last_debug_state
std::string generate_contents_links(const std::string §ion_name, config const *help_cfg)
std::string generate_topic_text(const std::string &generator, const config *help_cfg, const section &sec)
help::section default_toplevel
const topic * find_topic(const section &sec, const std::string &id)
Search for the topic with the specified identifier in the section and its subsections.
section parse_config(const config *cfg)
Parse a help config, return the top level section.
std::vector< topic > generate_era_topics(const bool sort_generated, const std::string &era_id)
const game_config_view * game_cfg
int last_num_encountered_terrains
help::section hidden_sections
std::vector< topic > generate_trait_topics(const bool sort_generated)
const std::string default_show_topic
void generate_era_sections(const config *help_cfg, section &sec, int level)
static bool is_cjk_char(const char32_t ch)
const std::string era_prefix
const std::string faction_prefix
bool is_scope_active(scope s)
Functions to load and save images from/to disk.
std::string img(const std::string &src, const std::string &align, bool floating)
Generates a Help markup tag corresponding to an image.
std::string make_link(const std::string &text, const std::string &dst)
Generates a Help markup tag corresponding to a reference or link.
std::string span_color(const color_t &color, Args &&... data)
Applies Pango markup to the input specifying its display color.
std::string tag(std::string_view tag, Args &&... data)
Wraps the given data in the specified tag.
config parse_text(const std::string &text)
Parse a xml style marked up text string.
rng * generator
This generator is automatically synced during synced context.
::tod_manager * tod_manager
std::vector< terrain_code > ter_list
int compare(const std::string &s1, const std::string &s2)
Case-sensitive lexicographical comparison.
@ STRIP_SPACES
REMOVE_EMPTY: remove empty elements.
std::vector< std::string > quoted_split(const std::string &val, char c, int flags, char quote)
This function is identical to split(), except it does not split when it otherwise would if the previo...
bool contains(const Container &container, const Value &value)
Returns true iff value is found in container.
std::map< std::string, t_string > string_map
std::vector< std::string > split(const config_attribute_value &val)
auto * find(Container &container, const Value &value)
Convenience wrapper for using find on a container without needing to comare to end()
std::string::const_iterator iterator
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Thrown when the help system fails to parse something.
A section contains topics and sections along with title and ID.
bool operator<(const section &) const
Comparison on the ID.
void add_section(const section &s)
Allocate memory for and add the section.
bool operator==(const section &) const
Two sections are equal if their IDs are equal.
A topic contains a title, an id and some text.
bool operator==(const topic &) const
Two topics are equal if their IDs are equal.
bool operator<(const topic &) const
Comparison on the ID.
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
Object which defines a time of day with associated bonuses, image, sounds etc.
static map_location::direction s
unit_type_data unit_types