Skip to content

Commit

Permalink
Help: That parameter isn't really needed
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel authored and Vultraz committed Apr 16, 2017
1 parent 0702e00 commit 5a52816
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
18 changes: 8 additions & 10 deletions src/help/help_impl.cpp
Expand Up @@ -203,8 +203,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;
Expand All @@ -214,7 +213,7 @@ void parse_config_internal(const config *help_cfg, const config *section_cfg,
if (const config &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;
Expand Down Expand Up @@ -306,7 +305,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 == "") {
Expand All @@ -317,7 +316,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);
}
Expand Down Expand Up @@ -1062,7 +1061,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;

Expand All @@ -1074,10 +1073,9 @@ std::string generate_contents_links(const section &sec, const std::vector<topic>
}
}

std::vector<topic>::const_iterator t;
for (t = topics.begin(); t != topics.end(); ++t) {
if (is_visible_id(t->id)) {
std::string link = make_link(t->title, t->id);
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";
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/help/help_impl.hpp
Expand Up @@ -230,11 +230,10 @@ 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_topic_text(const std::string &generator, const config *help_cfg, const section &sec);
std::string generate_about_text();
std::string generate_contents_links(const std::string& section_name, config const *help_cfg);
std::string generate_contents_links(const section &sec, const std::vector<topic>& topics);
std::string generate_contents_links(const section &sec);

/// return a hyperlink with the unit's name and pointing to the unit page
/// return empty string if this unit is hidden. If not yet discovered add the (?) suffix
Expand Down

0 comments on commit 5a52816

Please sign in to comment.