21 #define GETTEXT_DOMAIN "wesnoth-help"
42 #include "widgets/button.hpp"
52 #define WRN_DP LOG_STREAM(warn, log_display)
55 #define ERR_HELP LOG_STREAM(err, log_help)
90 std::string var_id =
t.get_cfg()[
"variation_id"].str();
92 var_id =
t.get_cfg()[
"variation_name"].str();
93 bool hide_help =
t.hide_help();
94 bool use_variation =
false;
95 if (!var_id.empty()) {
101 use_variation =
true;
144 void show_help(
const std::string& show_topic,
int xloc,
int yloc)
155 void show_unit_help(
const std::string& show_topic,
bool has_variations,
bool hidden,
int xloc,
int yloc)
189 const std::string& show_topic,
206 if (yloc <= -1 || xloc <= -1) {
207 xloc = canvas_size.x / 2 - width / 2;
208 yloc = canvas_size.y / 2 - height / 2;
210 std::vector<gui::button*> buttons_ptr;
212 buttons_ptr.push_back(&close_button_);
217 f.layout(xloc, yloc, width, height);
236 hb.
set_location(xloc + left_padding, yloc + top_padding);
237 hb.
set_width(width - left_padding - right_padding);
238 hb.
set_height(height - top_padding - bot_padding);
239 if (!show_topic.empty()) {
251 if (key[SDLK_ESCAPE]) {
256 button_it != buttons_ptr.end(); ++button_it) {
257 if ((*button_it)->pressed()) {
267 ERR_HELP <<
_(
"Parse error when parsing help text:") <<
" " <<
e.message;
270 std::stringstream
msg;
271 msg <<
_(
"Parse error when parsing help text:") <<
" '" <<
e.message <<
"'";
Class that keeps track of all the keys on the keyboard.
static game_config_manager * get()
A class grating read only view to a vector of config objects, viewed as one config with all children ...
static const style default_style
void show_topic(const std::string &topic_id)
Display the topic with the specified identifier.
const unit_type * find(const std::string &key, unit_type::BUILD_STATUS status=unit_type::FULL) const
Finds a unit_type by its id() and makes sure it is built to the specified level.
void build_all(unit_type::BUILD_STATUS status)
Makes sure the all unit_types are built to the specified level.
A single unit type that the player may recruit.
This class represents a single unit of a specific type.
static std::string _(const char *str)
const unit_type & type() const
This unit's type, accounting for gender and variation.
static lg::log_domain log_display("display")
static lg::log_domain log_help("help")
Standard logging facilities (interface).
void draw()
Trigger a draw cycle.
void raise_process_event()
void pump()
Process all events currently in the queue.
int relative_size(int size)
Game configuration data as global variables.
void show_transient_message(const std::string &title, const std::string &message, const std::string &image, const bool message_use_markup, const bool title_use_markup)
Shows a transient message to the user.
std::string hidden_symbol(bool hidden)
std::unique_ptr< help_manager > ensure_cache_lifecycle()
Helper function for any of the show_help functions to control the cache's lifecycle; can also be used...
void show_help(const std::string &show_topic, int xloc, int yloc)
Open the help browser, show topic with id show_topic.
int last_num_encountered_units
const std::string unit_prefix
const std::string variation_prefix
void show_variation_help(const std::string &unit, const std::string &variation, bool hidden, int xloc, int yloc)
Open the help browser, show the variation of the unit matching.
void show_terrain_description(const terrain_type &t)
void show_with_toplevel(const section &toplevel, const std::string &show_topic="", int xloc=-1, int yloc=-1)
Open a help dialog using a specified toplevel.
void show_terrain_help(const std::string &show_topic, bool hidden, int xloc, int yloc)
Open the help browser, show terrain with id terrain_id.
void show_unit_help(const std::string &show_topic, bool has_variations, bool hidden, int xloc, int yloc)
Open the help browser, show unit with id unit_id.
void generate_contents()
Generate the help contents from the configurations given to the manager.
const std::string terrain_prefix
boost::tribool last_debug_state
help::section default_toplevel
void show_unit_description(const unit &u)
const game_config_view * game_cfg
int last_num_encountered_terrains
help::section hidden_sections
const std::string default_show_topic
std::set< std::string > & encountered_units()
std::set< t_translation::terrain_code > & encountered_terrains()
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
point game_canvas_size()
The size of the game canvas, in drawing coordinates / game pixels.
std::string::const_iterator iterator
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
This file contains object "key", which is used to store information about keys while annotation parsi...
help_manager(const game_config_view *game_config)
Thrown when the help system fails to parse something.
A section contains topics and sections along with title and ID.
unit_type_data unit_types