Help: That parameter isn't really needed

This commit is contained in:
Celtic Minstrel 2017-04-10 02:49:58 -04:00 committed by Celtic Minstrel
parent 63ad2f4875
commit 3aa6993a32
2 changed files with 9 additions and 11 deletions

View file

@ -256,8 +256,7 @@ void parse_config_internal(const config *help_cfg, const config *section_cfg,
throw parse_error(ss.str());
}
std::vector<topic> generated_topics =
generate_topics(sort_generated,(*section_cfg)["generator"]);
std::vector<topic> generated_topics = generate_topics(sort_generated,(*section_cfg)["generator"]);
const std::vector<std::string> topics_id = utils::quoted_split((*section_cfg)["topics"]);
std::vector<topic> topics;
@ -267,7 +266,7 @@ void parse_config_internal(const config *help_cfg, const config *section_cfg,
if (auto topic_cfg = help_cfg->find_child("topic", "id", *it))
{
std::string text = topic_cfg["text"];
text += generate_topic_text(topic_cfg["generator"], help_cfg, sec, generated_topics);
text += generate_topic_text(topic_cfg["generator"], help_cfg, sec);
topic child_topic(topic_cfg["title"], topic_cfg["id"], text);
if (!is_valid_id(child_topic.id)) {
std::stringstream ss;
@ -359,7 +358,7 @@ void generate_sections(const config *help_cfg, const std::string &generator, sec
}
}
std::string generate_topic_text(const std::string &generator, const config *help_cfg, const section &sec, const std::vector<topic>& generated_topics)
std::string generate_topic_text(const std::string &generator, const config *help_cfg, const section &sec)
{
std::string empty_string = "";
if (generator.empty()) {
@ -368,7 +367,7 @@ std::string generate_topic_text(const std::string &generator, const config *help
std::vector<std::string> parts = utils::split(generator, ':');
if (parts.size() > 1 && parts[0] == "contents") {
if (parts[1] == "generated") {
return generate_contents_links(sec, generated_topics);
return generate_contents_links(sec);
} else {
return generate_contents_links(parts[1], help_cfg);
}
@ -1244,7 +1243,7 @@ std::string generate_contents_links(const std::string& section_name, config cons
return res.str();
}
std::string generate_contents_links(const section &sec, const std::vector<topic>& topics)
std::string generate_contents_links(const section &sec)
{
std::stringstream res;
@ -1255,7 +1254,7 @@ std::string generate_contents_links(const section &sec, const std::vector<topic>
}
}
for (auto &t : topics) {
for(const topic& t : sec.topics) {
if (is_visible_id(t.id)) {
std::string link = make_link(t.title, t.id);
res << font::unicode_bullet << " " << link << "\n";

View file

@ -222,10 +222,9 @@ struct parse_error : public game::error
/** Dispatch generators to their appropriate functions. */
void generate_sections(const config *help_cfg, const std::string &generator, section &sec, int level);
std::vector<topic> generate_topics(const bool sort_topics,const std::string &generator);
std::string generate_topic_text(const std::string &generator, const config *help_cfg,
const section &sec, const std::vector<topic>& generated_topics);
std::string generate_contents_links(const std::string& section_name, const config *help_cfg);
std::string generate_contents_links(const section &sec, const std::vector<topic>& topics);
std::string generate_topic_text(const std::string &generator, const config *help_cfg, const section &sec);
std::string generate_contents_links(const std::string& section_name, config const *help_cfg);
std::string generate_contents_links(const section &sec);
/**
* return a hyperlink with the unit's name and pointing to the unit page