void help_browser::show_topic(const std::string &topic_id) { const topic *t = find_topic(toplevel_, topic_id); if (t != NULL) { show_topic(*t); } else if (topic_id.find(unit_prefix)==0 || topic_id.find(hidden_symbol() + unit_prefix)==0) { show_topic(unknown_unit_topic); } else { std::cerr << "Help browser tried to show topic with id '" << topic_id << "' but that topic could not be found." << std::endl; } }
/// Return true if the id is valid for user defined topics and /// sections. Some IDs are special, such as toplevel and may not be /// be defined in the config. static bool is_valid_id(const std::string &id) { if (id == "toplevel") { return false; } if (id.find(unit_prefix) == 0 || id.find(hidden_symbol() + unit_prefix) == 0) { return false; } if (id.find("ability_") == 0) { return false; } if (id.find("weaponspecial_") == 0) { return false; } if (id == "hidden") { return false; } return true; }
/** * Open the help browser, show the variation of the unit matching. */ void show_variation_help(CVideo& video, const std::string& unit, const std::string &variation, bool hidden, int xloc, int yloc) { show_help(video, default_toplevel, hidden_symbol(hidden) + variation_prefix + unit + "_" + variation, xloc, yloc); }
/** * Open the help browser, show terrain with id terrain_id. * * If show_topic is the empty string, the default topic will be shown. */ void show_terrain_help(CVideo& video, const std::string& show_topic, bool hidden, int xloc, int yloc) { show_help(video, default_toplevel, hidden_symbol(hidden) + terrain_prefix + show_topic, xloc, yloc); }
/** * Open the help browser, show unit with id unit_id. * * If show_topic is the empty string, the default topic will be shown. */ void show_unit_help(CVideo& video, const std::string& show_topic, bool has_variations, bool hidden, int xloc, int yloc) { show_help(video, default_toplevel, hidden_symbol(hidden) + (has_variations ? ".." : "") + unit_prefix + show_topic, xloc, yloc); }
/** * Open the help browser, show the variation of the unit matching. */ void show_variation_help(display &disp, const std::string& unit, const std::string &variation, bool hidden, int xloc, int yloc) { show_help(disp, toplevel, hidden_symbol(hidden) + variation_prefix + unit + "_" + variation, xloc, yloc); }
/** * Open the help browser, show terrain with id terrain_id. * * If show_topic is the empty string, the default topic will be shown. */ void show_terrain_help(display &disp, const std::string& show_topic, bool hidden, int xloc, int yloc) { show_help(disp, toplevel, hidden_symbol(hidden) + terrain_prefix + show_topic, xloc, yloc); }
/** * Open the help browser, show unit with id unit_id. * * If show_topic is the empty string, the default topic will be shown. */ void show_unit_help(display &disp, const std::string& show_topic, bool has_variations, bool hidden, int xloc, int yloc) { show_help(disp, toplevel, hidden_symbol(hidden) + (has_variations ? ".." : "") + unit_prefix + show_topic, xloc, yloc); }