The Battle for Wesnoth  1.15.0-dev
Classes | Typedefs | Enumerations | Functions | Variables
help Namespace Reference

Classes

class  help_manager
 
struct  max_recursion_reached
 Thrown when trying to create a sub-section deeper than the max allowed depth. More...
 
struct  parse_error
 Thrown when the help manager fails to parse something. More...
 
class  plain_text_topic_generator
 
class  section
 A help section. More...
 
struct  string_less
 
class  terrain_topic_generator
 
struct  topic
 A topic contains a title, an id and some text. More...
 
class  topic_text_generator
 Abstract topic generator base class. More...
 
class  unit_topic_generator
 

Typedefs

using topic_list = std::list< topic >
 
using trait_data = std::pair< std::string, std::string >
 
using ter_data_cache = std::shared_ptr< terrain_type_data >
 

Enumerations

enum  UNIT_DESCRIPTION_TYPE { FULL_DESCRIPTION, NO_DESCRIPTION, NON_REVEALING_DESCRIPTION }
 

Functions

void show_help (const std::string &show_topic="")
 Open the help browser, show topic with id show_topic. More...
 
void reset ()
 Flags the help manager's contents for regeneration. More...
 
void show_unit_description (const unit &u)
 
void show_unit_description (const unit_type &t)
 
void show_unit_help (const std::string &unit_id, bool has_variations=false, bool hidden=false)
 Open the help browser, show unit with id unit_id. More...
 
void show_variation_help (const std::string &unit_id, const std::string &variation, bool hidden=false)
 Open the help browser, show the variation of the unit matching. More...
 
void show_terrain_description (const terrain_type &t)
 
void show_terrain_help (const std::string &unit_id, bool hidden=false)
 Open the help browser, show terrain with id terrain_id. More...
 
void generate_races_sections (section &sec)
 
void generate_terrain_sections (section &sec)
 
void generate_era_sections (section &sec)
 
void generate_unit_sections (section &sec, const std::string &race)
 
topic_list generate_ability_topics (const bool sort_generated)
 
topic_list generate_weapon_special_topics (const bool sort_generated)
 
topic_list generate_time_of_day_topics (const bool)
 
topic_list generate_trait_topics (const bool sort_generated)
 
topic_list generate_unit_topics (const bool sort_generated, const std::string &race)
 
topic_list generate_faction_topics (const bool sort_generated, const config &era)
 
topic_list generate_era_topics (const bool sort_generated, const std::string &era_id)
 
std::string hidden_symbol (bool hidden)
 
bool is_visible_id (const std::string &id)
 An ID beginning with '. More...
 
bool is_valid_id (const std::string &id)
 Return true if the id is valid for user defined topics and sections. More...
 
UNIT_DESCRIPTION_TYPE description_type (const unit_type &type)
 
std::string escape (const std::string &s)
 Prepend all chars with meaning inside attributes with a backslash. More...
 
ter_data_cache load_terrain_types_data ()
 Load the appropriate terrain types data to use. More...
 
std::string make_link (const std::string &text, const std::string &dst)
 
std::string jump_to (const unsigned pos)
 
std::string jump (const unsigned amount)
 

Variables

const unsigned max_section_recursion_level = 15
 
const unsigned max_history = 100
 
const std::string default_topic = "..introduction"
 Topic to open by default when opening the help browser. More...
 
const std::string unknown_unit_topic = ".unknown_unit"
 Topic to show when a unit hasn't been encountered in-game yet. More...
 
const std::string ability_prefix = "ability_"
 
const std::string era_prefix = "era_"
 
const std::string faction_prefix = "faction_"
 
const std::string race_prefix = "race_"
 
const std::string terrain_prefix = "terrain_"
 
const std::string tod_prefix = "time_of_day_"
 
const std::string trait_prefix = "traits_"
 
const std::string unit_prefix = "unit_"
 
const std::string variation_prefix = "variation_"
 
const std::string weapon_special_prefix = "weaponspecial_"
 
static help_manager manager
 The help manager. More...
 

Typedef Documentation

◆ ter_data_cache

using help::ter_data_cache = typedef std::shared_ptr<terrain_type_data>

Definition at line 79 of file utils.hpp.

◆ topic_list

using help::topic_list = typedef std::list<topic>

Definition at line 78 of file topic.hpp.

◆ trait_data

using help::trait_data = typedef std::pair<std::string, std::string>

Definition at line 297 of file topic_text_generators.cpp.

Enumeration Type Documentation

◆ UNIT_DESCRIPTION_TYPE

Enumerator
FULL_DESCRIPTION 
NO_DESCRIPTION 
NON_REVEALING_DESCRIPTION 

Definition at line 46 of file utils.hpp.

Function Documentation

◆ description_type()

UNIT_DESCRIPTION_TYPE help::description_type ( const unit_type type)

◆ escape()

std::string help::escape ( const std::string &  s)

Prepend all chars with meaning inside attributes with a backslash.

Definition at line 94 of file utils.cpp.

References utils::escape().

Referenced by help::unit_topic_generator::generate(), and make_link().

◆ generate_ability_topics()

topic_list help::generate_ability_topics ( const bool  sort_generated)

◆ generate_era_sections()

void help::generate_era_sections ( section sec)

◆ generate_era_topics()

topic_list help::generate_era_topics ( const bool  sort_generated,
const std::string &  era_id 
)

◆ generate_faction_topics()

topic_list help::generate_faction_topics ( const bool  sort_generated,
const config era 
)

◆ generate_races_sections()

void help::generate_races_sections ( section sec)

◆ generate_terrain_sections()

void help::generate_terrain_sections ( section sec)

◆ generate_time_of_day_topics()

topic_list help::generate_time_of_day_topics ( const bool  )

◆ generate_trait_topics()

topic_list help::generate_trait_topics ( const bool  sort_generated)

◆ generate_unit_sections()

void help::generate_unit_sections ( section sec,
const std::string &  race 
)

◆ generate_unit_topics()

topic_list help::generate_unit_topics ( const bool  sort_generated,
const std::string &  race 
)

◆ generate_weapon_special_topics()

topic_list help::generate_weapon_special_topics ( const bool  sort_generated)

◆ hidden_symbol()

std::string help::hidden_symbol ( bool  hidden)

◆ is_valid_id()

bool help::is_valid_id ( const std::string &  id)

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.

Definition at line 54 of file utils.cpp.

References ability_prefix, translation::compare(), hidden_symbol(), unit_prefix, and weapon_special_prefix.

Referenced by help::section::initialize().

◆ is_visible_id()

bool help::is_visible_id ( const std::string &  id)

An ID beginning with '.

' denotes a hidden section or topic.

Definition at line 49 of file utils.cpp.

Referenced by gui2::dialogs::help_browser::add_topics_for_section(), help::section::print_table_of_contents(), and help::section::print_table_of_contents_for().

◆ jump()

std::string help::jump ( const unsigned  amount)
inline

Definition at line 74 of file utils.hpp.

Referenced by help::unit_topic_generator::generate(), and generate_time_of_day_topics().

◆ jump_to()

std::string help::jump_to ( const unsigned  pos)
inline

Definition at line 69 of file utils.hpp.

Referenced by generate_time_of_day_topics().

◆ load_terrain_types_data()

ter_data_cache help::load_terrain_types_data ( )

Load the appropriate terrain types data to use.

Definition at line 99 of file utils.cpp.

References d, g, game_config_manager::get(), and display::get_singleton().

Referenced by help::terrain_topic_generator::generate(), help::unit_topic_generator::generate(), generate_terrain_sections(), and gui2::get_mp_tooltip().

◆ make_link()

std::string help::make_link ( const std::string &  text,
const std::string &  dst 
)
inline

◆ reset()

void help::reset ( )

◆ show_help()

void help::show_help ( const std::string &  show_topic = "")

◆ show_terrain_description()

void help::show_terrain_description ( const terrain_type t)

◆ show_terrain_help()

void help::show_terrain_help ( const std::string &  unit_id,
bool  hidden = false 
)

Open the help browser, show terrain with id terrain_id.

If show_topic is the empty string, the default topic will be shown.

Definition at line 94 of file help.cpp.

References hidden_symbol(), show_help(), and terrain_prefix.

Referenced by show_terrain_description().

◆ show_unit_description() [1/2]

void help::show_unit_description ( const unit u)

◆ show_unit_description() [2/2]

void help::show_unit_description ( const unit_type t)

◆ show_unit_help()

void help::show_unit_help ( const std::string &  unit_id,
bool  has_variations = false,
bool  hidden = false 
)

Open the help browser, show unit with id unit_id.

If show_topic is the empty string, the default topic will be shown.

Definition at line 79 of file help.cpp.

References hidden_symbol(), show_help(), and unit_prefix.

Referenced by show_unit_description(), and editor::editor_controller::unit_description().

◆ show_variation_help()

void help::show_variation_help ( const std::string &  unit,
const std::string &  variation,
bool  hidden 
)

Open the help browser, show the variation of the unit matching.

Definition at line 84 of file help.cpp.

References hidden_symbol(), show_help(), and variation_prefix.

Referenced by show_unit_description().

Variable Documentation

◆ ability_prefix

const std::string help::ability_prefix = "ability_"

◆ default_topic

const std::string help::default_topic = "..introduction"

Topic to open by default when opening the help browser.

Definition at line 22 of file constants.cpp.

Referenced by help::help_manager::open_help_browser_to().

◆ era_prefix

const std::string help::era_prefix = "era_"

Definition at line 26 of file constants.cpp.

Referenced by generate_era_sections(), and generate_era_topics().

◆ faction_prefix

const std::string help::faction_prefix = "faction_"

Definition at line 27 of file constants.cpp.

Referenced by generate_faction_topics().

◆ manager

help_manager help::manager
static

◆ max_history

const unsigned help::max_history = 100

Definition at line 20 of file constants.cpp.

◆ max_section_recursion_level

const unsigned help::max_section_recursion_level = 15

Definition at line 19 of file constants.cpp.

Referenced by help::section::initialize().

◆ race_prefix

const std::string help::race_prefix = "race_"

◆ terrain_prefix

const std::string help::terrain_prefix = "terrain_"

◆ tod_prefix

const std::string help::tod_prefix = "time_of_day_"

Definition at line 30 of file constants.cpp.

Referenced by generate_time_of_day_topics().

◆ trait_prefix

const std::string help::trait_prefix = "traits_"

Definition at line 31 of file constants.cpp.

Referenced by generate_trait_topics().

◆ unit_prefix

const std::string help::unit_prefix = "unit_"

◆ unknown_unit_topic

const std::string help::unknown_unit_topic = ".unknown_unit"

Topic to show when a unit hasn't been encountered in-game yet.

Definition at line 23 of file constants.cpp.

Referenced by help::unit_topic_generator::generate().

◆ variation_prefix

const std::string help::variation_prefix = "variation_"

◆ weapon_special_prefix

const std::string help::weapon_special_prefix = "weaponspecial_"

Definition at line 34 of file constants.cpp.

Referenced by generate_weapon_special_topics(), and is_valid_id().