diff --git a/data/core/help.cfg b/data/core/help.cfg index 23836b78a184..799b4fdf6bdd 100644 --- a/data/core/help.cfg +++ b/data/core/help.cfg @@ -1,7 +1,7 @@ #textdomain wesnoth-help [help] [toplevel] - sections=introduction,gameplay,units,abilities_section,traits_section,weapon_specials,factions_section,terrains_section,addons,commands,encyclopedia + sections=introduction,gameplay,units,abilities_section,traits_section,weapon_specials,eras_section,terrains_section,addons,commands,encyclopedia topics=about,license [/toplevel] @@ -52,10 +52,12 @@ [/section] [section] - id=factions_section - title= _ "Factions" - generator=factions - sort_topics=generated + id=eras_section + title= _ "Eras" + sections_generator=eras + sort_sections=generated + sort_topics=yes + topics=..eras_section [/section] [section] @@ -95,6 +97,17 @@ generator="contents:generated" [/topic] + [topic] + id=..eras_section + title= _ "Eras" + text=_"A faction is a collection of units and leaders. Factions are assigned to sides in multiplayer games. + +" + _"An era is a collection of factions, intended to be played against one another. Besides the mainline eras that come with the game, many user-made factions are available from add-ons. + +" + generator="contents:generated" + [/topic] + [topic] id=..abilities_section title= _ "Abilities" @@ -569,7 +582,9 @@ Single-player campaigns are collections of scenarios that fit together to tell a For gameplay purposes, various races of creatures in the world cooperate with each other in factions. Factions are grouped in balanced sets with a common theme; for example, the main factions of Wesnoth can be found in the included Default Era. -In text='Multiplayer' mode, you can choose an era when creating a new game, and players can pick from the available factions for that era when setting up their sides and teams." + _ " +In text='Multiplayer' mode, you can choose an era when creating a new game, and players can pick from the available factions for that era when setting up their sides and teams." + _" + +You can see what eras you have loaded in the text='eras' dst='..eras_section' of the help." + _ "
text='Multiplayer Modifications'
" + _ " diff --git a/data/multiplayer/factions/drakes-aoh.cfg b/data/multiplayer/factions/drakes-aoh.cfg index 8ed9ae7e6b61..da276e494bd2 100644 --- a/data/multiplayer/factions/drakes-aoh.cfg +++ b/data/multiplayer/factions/drakes-aoh.cfg @@ -9,6 +9,9 @@ random_leader=Drake Flameheart,Inferno Drake,Drake Enforcer,Drake Warden,Drake Blademaster recruit=Drake Burner,Fire Drake,Drake Clasher,Drake Glider,Drake Fighter,Saurian Skirmisher,Saurian Augur,Drake Warrior,Drake Flare,Drake Thrasher,Sky Drake,Drake Arbiter,Saurian Ambusher,Saurian Soothsayer,Saurian Oracle terrain_liked=Hh, Ha, Ds, Ss + description=_"src='portraits/drakes/inferno.png~BG()' align='middle' + +The text='Drakes' are a faction of dragon-like text='Drakes' dst='..race_drake' and their lizard text='Saurian' dst='..race_lizard' allies. Drakes are descendants of dragons, but smaller in size. Saurians are considerably smaller than Drakes and from different ancestry. Together, the Drake faction has high mobility but low defense, leading to unusual tactics for a text='Default Era' dst='..era_era_default' faction." [ai] recruitment_pattern=fighter,fighter,archer,healer,scout,scout [/ai] diff --git a/data/multiplayer/factions/drakes-default.cfg b/data/multiplayer/factions/drakes-default.cfg index c01fe8b3b5d0..fd773f753c86 100644 --- a/data/multiplayer/factions/drakes-default.cfg +++ b/data/multiplayer/factions/drakes-default.cfg @@ -9,4 +9,7 @@ random_leader=Drake Flare,Fire Drake,Drake Arbiter,Drake Thrasher,Drake Warrior recruit=Drake Burner,Drake Clasher,Drake Glider,Drake Fighter,Saurian Skirmisher,Saurian Augur terrain_liked=Hh, Ha, Ds, Ss + description=_"src='portraits/drakes/inferno.png~BG()' align='middle' + +The text='Drakes' are a faction of dragon-like text='Drakes' dst='..race_drake' and their lizard text='Saurian' dst='..race_lizard' allies. Drakes are descendants of dragons, but smaller in size. Saurians are considerably smaller than Drakes and from different ancestry. Together, the Drake faction has high mobility but low defense, leading to unusual tactics for a text='Default Era' dst='..era_era_default' faction." [/multiplayer_side] diff --git a/data/multiplayer/factions/knalgans-aoh.cfg b/data/multiplayer/factions/knalgans-aoh.cfg index 86eb6b8aad8f..04be0c549fdc 100644 --- a/data/multiplayer/factions/knalgans-aoh.cfg +++ b/data/multiplayer/factions/knalgans-aoh.cfg @@ -8,6 +8,9 @@ leader=Dwarvish Lord,Dwarvish Dragonguard,Dwarvish Sentinel,Assassin,Huntsman,Ranger recruit=Dwarvish Guardsman,Dwarvish Stalwart,Dwarvish Fighter,Dwarvish Steelclad,Dwarvish Ulfserker,Dwarvish Berserker,Dwarvish Thunderer,Dwarvish Thunderguard,Thief,Rogue,Poacher,Trapper,Footpad,Outlaw,Gryphon Rider,Gryphon Master terrain_liked=Hh, Ha, Mm + description=_"src='portraits/dwarves/ulfserker.png~BG()' align='middle' + +The text='Knalgan Alliance' is a faction of text='Dwarves' dst='..race_dwarf' and their outlaw text='Human' dst='..race_human' allies. Dwarves are an old race who live underground and have tough, but short, warriors. The outlaws are humans who are not socially acceptable among others of their race, but have become allies of the dwarves due to common enemies. This leads to a combination of tough and defensive dwarves who are only good on certain terrain and humans who can cover ground that dwarves are not good at fighting in." [ai] recruitment_pattern=fighter,fighter,fighter,mixed fighter,archer,scout [/ai] diff --git a/data/multiplayer/factions/knalgans-default.cfg b/data/multiplayer/factions/knalgans-default.cfg index 8af0788bab7c..0a3ee089f38a 100644 --- a/data/multiplayer/factions/knalgans-default.cfg +++ b/data/multiplayer/factions/knalgans-default.cfg @@ -8,6 +8,9 @@ leader=Dwarvish Steelclad,Dwarvish Thunderguard,Dwarvish Stalwart,Rogue,Trapper recruit=Dwarvish Guardsman,Dwarvish Fighter,Dwarvish Ulfserker,Dwarvish Thunderer,Thief,Poacher,Footpad,Gryphon Rider terrain_liked=Hh, Ha, Mm + description=_"src='portraits/dwarves/ulfserker.png~BG()' align='middle' + +The text='Knalgan Alliance' is a faction of text='Dwarves' dst='..race_dwarf' and their outlaw text='Human' dst='..race_human' allies. Dwarves are an old race who live underground and have tough, but short, warriors. The outlaws are humans who are not socially acceptable among others of their race, but have become allies of the dwarves due to common enemies. This leads to a combination of tough and defensive dwarves who are only good on certain terrain and humans who can cover ground that dwarves are not good at fighting in." [ai] [aspect] id=recruitment_pattern diff --git a/data/multiplayer/factions/loyalists-aoh.cfg b/data/multiplayer/factions/loyalists-aoh.cfg index 0eaae2e19a1e..5844129f428f 100644 --- a/data/multiplayer/factions/loyalists-aoh.cfg +++ b/data/multiplayer/factions/loyalists-aoh.cfg @@ -9,6 +9,9 @@ random_leader=General,Royal Guard,Halberdier,Master Bowman,Mage of Light,Arch Mage recruit=Cavalryman,Dragoon,Horseman,Lancer,Knight,Spearman,Swordsman,Pikeman,Javelineer,Fencer,Duelist,Heavy Infantryman,Shock Trooper,Bowman,Longbowman,Mage,Red Mage,White Mage,Merman Fighter,Merman Warrior,Ogre,Lieutenant terrain_liked=Gg, Ww, Wo + description=_"src='portraits/humans/general.png~BG()' align='middle' + +The text='Loyalists' are a faction of text='Humans' dst='..race_human' who are loyal to the throne of Wesnoth. Humans are a versatile race who specialize in many different areas. Similarly, the Loyalist faction is a very versatile melee-oriented faction with important ranged support from bowmen and mages." [ai] recruitment_pattern=fighter,fighter,fighter,archer,mixed fighter,scout [/ai] diff --git a/data/multiplayer/factions/loyalists-default.cfg b/data/multiplayer/factions/loyalists-default.cfg index 26cd26b57b54..40e247fba1ac 100644 --- a/data/multiplayer/factions/loyalists-default.cfg +++ b/data/multiplayer/factions/loyalists-default.cfg @@ -9,6 +9,9 @@ random_leader=Lieutenant,Swordsman,Pikeman,Javelineer,Longbowman,White Mage,Red Mage recruit=Cavalryman,Horseman,Spearman,Fencer,Heavy Infantryman,Bowman,Mage,Merman Fighter terrain_liked=Gg, Ww, Wo + description=_"src='portraits/humans/general.png~BG()' align='middle' + +The text='Loyalists' are a faction of text='Humans' dst='..race_human' who are loyal to the throne of Wesnoth. Humans are a versatile race who specialize in many different areas. Similarly, the Loyalist faction is a very versatile melee-oriented faction with important ranged support from bowmen and mages." [ai] recruitment_pattern=fighter,fighter,fighter,archer,mixed fighter,scout [/ai] diff --git a/data/multiplayer/factions/northerners-aoh.cfg b/data/multiplayer/factions/northerners-aoh.cfg index 9984b48bf079..d342016c2a72 100644 --- a/data/multiplayer/factions/northerners-aoh.cfg +++ b/data/multiplayer/factions/northerners-aoh.cfg @@ -9,6 +9,9 @@ random_leader=Orcish Warlord,Troll Warrior,Orcish Slurbow recruit=Orcish Grunt,Orcish Warrior,Troll Whelp,Troll,Troll Rocklobber,Wolf Rider,Goblin Knight,Goblin Pillager,Orcish Archer,Orcish Crossbowman,Orcish Assassin,Orcish Slayer,Naga Fighter,Naga Warrior,Goblin Spearman,Goblin Impaler,Goblin Rouser terrain_liked=Hh, Ha, Mm, Ss + description=_"src='portraits/orcs/sovereign.png~BG()' align='middle' + +The text='Northerners' are a faction of text='Orcs' dst='..race_orc' and their allies who live in the north of the Great Continent, thus their name. Northerners consist of the warrior orcs race, the enslaved text='goblins' dst='..race_goblin', text='trolls' dst='..race_troll' who are tricked into combat by the orcs, and the serpentine text='naga' dst='..race_naga'. The Northerners play best by taking advantage of having many low-cost and high HP soldiers." [ai] recruitment_pattern=fighter,fighter,fighter,mixed fighter,archer,scout [/ai] diff --git a/data/multiplayer/factions/northerners-default.cfg b/data/multiplayer/factions/northerners-default.cfg index b63da4323989..f678ec261ca8 100644 --- a/data/multiplayer/factions/northerners-default.cfg +++ b/data/multiplayer/factions/northerners-default.cfg @@ -8,6 +8,9 @@ leader=Orcish Warrior,Troll,Troll Rocklobber,Orcish Crossbowman,Orcish Slayer recruit=Orcish Grunt,Troll Whelp,Wolf Rider,Orcish Archer,Orcish Assassin,Naga Fighter,Goblin Spearman terrain_liked=Hh, Ha, Mm, Ss + description=_"src='portraits/orcs/sovereign.png~BG()' align='middle' + +The text='Northerners' are a faction of text='Orcs' dst='..race_orc' and their allies who live in the north of the Great Continent, thus their name. Northerners consist of the warrior orcs race, the enslaved text='goblins' dst='..race_goblin', text='trolls' dst='..race_troll' who are tricked into combat by the orcs, and the serpentine text='naga' dst='..race_naga'. The Northerners play best by taking advantage of having many low-cost and high HP soldiers." [ai] recruitment_pattern=fighter,fighter,fighter,mixed fighter,archer,scout [/ai] diff --git a/data/multiplayer/factions/rebels-aoh.cfg b/data/multiplayer/factions/rebels-aoh.cfg index 049dc07442e0..bff67aad3285 100644 --- a/data/multiplayer/factions/rebels-aoh.cfg +++ b/data/multiplayer/factions/rebels-aoh.cfg @@ -9,6 +9,9 @@ random_leader=Elvish Marshal,Elvish Champion,Elvish Avenger,Elvish Sharpshooter,Mage of Light,Arch Mage,Silver Mage,Elvish Shyde,Elvish Enchantress recruit=Elvish Fighter,Elvish Hero,Elvish Captain,Elvish Archer,Elvish Marksman,Elvish Ranger,Mage,Red Mage,White Mage,Elvish Shaman,Elvish Druid,Elvish Sorceress,Elvish Scout,Elvish Rider,Wose,Elder Wose,Merman Hunter,Merman Spearman,Merman Netcaster terrain_liked=Ff, Fa, Ss, Ww + description=_"src='portraits/elves/druid.png~BG()' align='middle' + +The text='Rebels' are a faction of text='Elves' dst='..race_elf' and their various forest-dwelling allies. They get their human name, Rebels, from the time of Heir to the Throne, when they started the rebellion against the evil Queen Asheviere. Elves are a magical race that are masters of the bow and are capable of living many years longer than humans. In harmony with nature, the elves find allies with the text='human' dst='..race_human' mages, certain text='merfolk' dst='..race_merman', and text='tree creatures' dst='..race_wose' called 'Woses.' Rebels are best played taking advantage of their high forest defense, mastery of ranged attacks, and the elves' neutral alignment." [ai] recruitment_pattern=fighter,fighter,archer,archer,mixed fighter,healer,scout [/ai] diff --git a/data/multiplayer/factions/rebels-default.cfg b/data/multiplayer/factions/rebels-default.cfg index f9d17f944023..ee62374105d8 100644 --- a/data/multiplayer/factions/rebels-default.cfg +++ b/data/multiplayer/factions/rebels-default.cfg @@ -9,6 +9,9 @@ random_leader=Elvish Captain,Elvish Hero,Elvish Ranger,Elvish Marksman,Elvish Druid,Elvish Sorceress,White Mage,Red Mage recruit=Elvish Fighter,Elvish Archer,Mage,Elvish Shaman,Elvish Scout,Wose,Merman Hunter terrain_liked=Ff, Fa, Ss, Ww + description=_"src='portraits/elves/druid.png~BG()' align='middle' + +The text='Rebels' are a faction of text='Elves' dst='..race_elf' and their various forest-dwelling allies. They get their human name, Rebels, from the time of Heir to the Throne, when they started the rebellion against the evil Queen Asheviere. Elves are a magical race that are masters of the bow and are capable of living many years longer than humans. In harmony with nature, the elves find allies with the text='human' dst='..race_human' mages, certain text='merfolk' dst='..race_merman', and text='tree creatures' dst='..race_wose' called 'Woses.' Rebels are best played taking advantage of their high forest defense, mastery of ranged attacks, and the elves' neutral alignment." [ai] recruitment_pattern=fighter,fighter,archer,archer,mixed fighter,healer,scout [/ai] diff --git a/data/multiplayer/factions/undead-aoh.cfg b/data/multiplayer/factions/undead-aoh.cfg index d9f157534aca..384ae970d102 100644 --- a/data/multiplayer/factions/undead-aoh.cfg +++ b/data/multiplayer/factions/undead-aoh.cfg @@ -9,6 +9,9 @@ random_leader=Lich,Necromancer,Draug,Banebow recruit=Skeleton,Revenant,Deathblade,Skeleton Archer,Bone Shooter,Walking Corpse,Soulless,Ghost,Wraith,Shadow,Vampire Bat,Blood Bat,Ghoul,Necrophage,Dark Adept,Dark Sorcerer terrain_liked=Ss, Hh, Ha, Ww + description=_"src='portraits/undead/wraith.png~BG()' align='middle' + +The text='Undead' are a faction of text='undead' dst='..race_undead' creatures and text='human' dst='..race_human' practitioners of dark arts that usually accompany them. Often, these 'Dark Adepts' are the units that do the most damage for the faction, but they have a major vulnerability - their practicing of this forbidden, evil magic has consumed all their energy and so they have no melee attack at all. The Undead are a very aggressive faction and the most powerful text='Default Era' dst='..era_era_default' faction at nighttime." [ai] recruitment_pattern=fighter,fighter,fighter,mixed fighter,archer,scout [/ai] diff --git a/data/multiplayer/factions/undead-default.cfg b/data/multiplayer/factions/undead-default.cfg index 6b4dedd82867..3abe3dbfea9c 100644 --- a/data/multiplayer/factions/undead-default.cfg +++ b/data/multiplayer/factions/undead-default.cfg @@ -9,6 +9,9 @@ random_leader=Dark Sorcerer,Revenant,Deathblade,Bone Shooter recruit=Skeleton,Skeleton Archer,Walking Corpse,Ghost,Vampire Bat,Dark Adept,Ghoul terrain_liked=Ss, Hh, Ha, Ww + description=_"src='portraits/undead/wraith.png~BG()' align='middle' + +The text='Undead' are a faction of text='undead' dst='..race_undead' creatures and text='human' dst='..race_human' practitioners of dark arts that usually accompany them. Often, these 'Dark Adepts' are the units that do the most damage for the faction, but they have a major vulnerability - their practicing of this forbidden, evil magic has consumed all their energy and so they have no melee attack at all. The Undead are a very aggressive faction and the most powerful text='Default Era' dst='..era_era_default' faction at nighttime." [ai] recruitment_pattern=fighter,fighter,archer,fighter,scout,archer [/ai] diff --git a/src/help.cpp b/src/help.cpp index 402b876f4581..84684ddbd5da 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -48,6 +48,10 @@ static lg::log_domain log_display("display"); #define WRN_DP LOG_STREAM(warn, log_display) +static lg::log_domain log_help("help"); +#define WRN_HP LOG_STREAM(warn, log_help) +#define DBG_HP LOG_STREAM(debug, log_help) + namespace help { help_button::help_button(display& disp, const std::string &help_topic) @@ -542,7 +546,10 @@ enum UNIT_DESCRIPTION_TYPE {FULL_DESCRIPTION, NO_DESCRIPTION, NON_REVEALING_DESC static UNIT_DESCRIPTION_TYPE description_type(const unit_type &type); static std::vector generate_ability_topics(const bool); static std::vector generate_weapon_special_topics(const bool); -static std::vector generate_faction_topics(const bool); + +static void generate_era_sections(const config *help_cfg, section &sec, int level); +static std::vector generate_faction_topics(const config &, const bool); +static std::vector generate_era_topics(const bool, const std::string & era_id); /// Parse a help config, return the top level section. Return an empty /// section if cfg is NULL. @@ -628,6 +635,7 @@ namespace { const std::string terrain_prefix = "terrain_"; const std::string race_prefix = "race_"; const std::string faction_prefix = "faction_"; + const std::string era_prefix = "era_"; const std::string variation_prefix = "variation_"; // id starting with '.' are hidden @@ -1030,12 +1038,14 @@ std::vector generate_topics(const bool sort_generated,const std::string & res = generate_ability_topics(sort_generated); } else if (generator == "weapon_specials") { res = generate_weapon_special_topics(sort_generated); - } else if (generator == "factions") { - res = generate_faction_topics(sort_generated); } else { std::vector parts = utils::split(generator, ':', utils::STRIP_SPACES); if (parts[0] == "units" && parts.size()>1) { res = generate_unit_topics(sort_generated, parts[1]); + } else if (parts[0] == "era" && parts.size()>1) { + res = generate_era_topics(sort_generated, parts[1]); + } else { + WRN_HP << "Found a topic generator that I didn't recognize: " << generator << "\n"; } } @@ -1048,10 +1058,15 @@ void generate_sections(const config *help_cfg, const std::string &generator, sec generate_races_sections(help_cfg, sec, level); } else if (generator == "terrains") { generate_terrain_sections(help_cfg, sec, level); + } else if (generator == "eras") { + DBG_HP << "Generating eras...\n"; + generate_era_sections(help_cfg, sec, level); } else { std::vector parts = utils::split(generator, ':', utils::STRIP_SPACES); if (parts[0] == "units" && parts.size()>1) { generate_unit_sections(help_cfg, sec, level, true, parts[1]); + } else if (generator.size() > 0) { + WRN_HP << "Found a section generator that I didn't recognize: " << generator << "\n"; } } } @@ -1232,45 +1247,17 @@ std::vector generate_ability_topics(const bool sort_generated) return topics; } -std::vector generate_faction_topics(const bool sort_generated) +std::vector generate_era_topics(const bool sort_generated, const std::string & era_id) { std::vector topics; - const config& era = game_cfg->child("era"); - if (era) { - std::vector faction_links; - BOOST_FOREACH(const config &f, era.child_range("multiplayer_side")) { - const std::string& id = f["id"]; - if (id == "Random") - continue; - - std::stringstream text; - const config::attribute_value& description = f["description"]; - if (!description.empty()) { - text << description.t_str() << "\n"; - text << "\n"; - } + const config & era = game_cfg->find_child("era","id", era_id); + if(era) { + topics = generate_faction_topics(era, sort_generated); - text << "
text='" << _("Leaders:") << "'
" << "\n"; - const std::vector leaders = - make_unit_links_list( utils::split(f["leader"]), true ); - BOOST_FOREACH(const std::string &link, leaders) { - text << link << "\n"; - } - - text << "\n"; - - text << "
text='" << _("Recruits:") << "'
" << "\n"; - const std::vector recruits = - make_unit_links_list( utils::split(f["recruit"]), true ); - BOOST_FOREACH(const std::string &link, recruits) { - text << link << "\n"; - } - - const std::string name = f["name"]; - const std::string ref_id = faction_prefix + id; - topics.push_back( topic(name, ref_id, text.str()) ); - faction_links.push_back(make_link(name, ref_id)); + std::vector faction_links; + BOOST_FOREACH(const topic & t, topics) { + faction_links.push_back(make_link(t.title, t.id)); } std::stringstream text; @@ -1289,12 +1276,85 @@ std::vector generate_faction_topics(const bool sort_generated) text << link << "\n"; } - topics.push_back( topic(_("Factions"), "..factions_section", text.str()) ); - } else { - topics.push_back( topic( _("Factions"), "..factions_section", - _("Factions are only used in multiplayer")) ); + topic era_topic(era["name"], ".." + era_prefix + era["id"].str(), text.str()); + + topics.push_back( era_topic ); } + return topics; +} + +std::vector generate_faction_topics(const config & era, const bool sort_generated) +{ + std::vector topics; + BOOST_FOREACH(const config &f, era.child_range("multiplayer_side")) { + const std::string& id = f["id"]; + if (id == "Random") + continue; + + std::stringstream text; + + const config::attribute_value& description = f["description"]; + if (!description.empty()) { + text << description.t_str() << "\n"; + text << "\n"; + } + + const std::vector recruit_ids = utils::split(f["recruit"]); + std::set races; + std::set alignments; + BOOST_FOREACH(const std::string & u_id, recruit_ids) { + if (const unit_type * t = unit_types.find(u_id, unit_type::HELP_INDEXED)) { + const unit_type & type = *t; + + unit_types.build_unit_type(type, unit_type::WITHOUT_ANIMATIONS); + + if (const unit_race *r = unit_types.find_race(type.race_id())) { + races.insert(make_link(r->plural_name(), std::string("..") + race_prefix + r->id())); + } + DBG_HP << type.alignment() << " -> " << type.alignment_description(type.alignment(), type.genders().front()) << "\n"; + alignments.insert(make_link(type.alignment_description(type.alignment(), type.genders().front()), "time_of_day")); + } + } + + if (races.size() > 0) { + std::set::iterator it = races.begin(); + text << _("Races: ") << *(it++); + while(it != races.end()) { + text << ", " << *(it++); + } + text << "\n\n"; + } + + if (alignments.size() > 0) { + std::set::iterator it = alignments.begin(); + text << _("Alignments: ") << *(it++); + while(it != alignments.end()) { + text << ", " << *(it++); + } + text << "\n\n"; + } + + text << "
text='" << _("Leaders:") << "'
" << "\n"; + const std::vector leaders = + make_unit_links_list( utils::split(f["leader"]), true ); + BOOST_FOREACH(const std::string &link, leaders) { + text << link << "\n"; + } + + text << "\n"; + + text << "
text='" << _("Recruits:") << "'
" << "\n"; + const std::vector recruit_links = + make_unit_links_list( recruit_ids, true ); + BOOST_FOREACH(const std::string &link, recruit_links) { + text << link << "\n"; + } + + const std::string name = f["name"]; + const std::string ref_id = faction_prefix + id; + topics.push_back( topic(name, ref_id, text.str()) ); + } if (sort_generated) std::sort(topics.begin(), topics.end(), title_less()); return topics; @@ -1392,7 +1452,7 @@ class terrain_topic_generator: public topic_generator ss << type_.help_topic_text().str() << "\n"; if (!display::get_singleton()) { - WRN_DP << "When building terrain help topics, the display object was null and we couldn't finish.\n"; + WRN_HP << "When building terrain help topics, the display object was null and we couldn't finish.\n"; return ss.str(); } // abort early if we can't get a gamemap object from the display const gamemap & map = display::get_singleton()->get_disp_context().map(); @@ -2021,7 +2081,7 @@ class unit_topic_generator: public topic_generator ss << generate_table(table); } else { - WRN_DP << "When building unit help topics, the display object was null and we couldn't get the terrain info we need.\n"; + WRN_HP << "When building unit help topics, the display object was null and we couldn't get the terrain info we need.\n"; } return ss.str(); } @@ -2108,10 +2168,29 @@ void generate_races_sections(const config *help_cfg, section &sec, int level) } } +void generate_era_sections(const config* help_cfg, section & sec, int level) +{ + BOOST_FOREACH(const config & era, game_cfg->child_range("era")) { + DBG_HP << "Adding help section: " << era["id"].str() << "\n"; + + section era_section; + config section_cfg; + section_cfg["id"] = era_prefix + era["id"].str(); + section_cfg["title"] = era["name"]; + + section_cfg["generator"] = "era:" + era["id"].str(); + + DBG_HP << section_cfg.debug() << "\n"; + + parse_config_internal(help_cfg, §ion_cfg, era_section, level+1); + sec.add_section(era_section); + } +} + void generate_terrain_sections(const config* /*help_cfg*/, section& sec, int /*level*/) { if (display::get_singleton() == NULL) { - WRN_DP << "When building terrain help sections, the display object was null, aborting.\n"; + WRN_HP << "When building terrain help sections, the display object was null, aborting.\n"; return; }