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();
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()) {
270 std::stringstream
msg;
271 msg <<
_(
"Parse error when parsing help text:") <<
" '" << e.
message <<
"'";
void show_help(const std::string &show_topic, int xloc, int yloc)
Open the help browser, show topic with id show_topic.
const std::string unit_prefix
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.
This class represents a single unit of a specific type.
void show_terrain_description(const terrain_type &t)
static const style default_style
A section contains topics and sections along with title and ID.
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.
boost::tribool last_debug_state
int relative_size(int size)
Thrown when the help system fails to parse something.
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 build_all(unit_type::BUILD_STATUS status)
Makes sure the all unit_types are built to the specified level.
unit_type_data unit_types
const config & get_cfg() const
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
static std::string _(const char *str)
const std::string terrain_prefix
int last_num_encountered_terrains
Definitions for the interface to Wesnoth Markup Language (WML).
bool hide_help() const
For instances created from a [terrain_type] tag, the value in the tag (with default false)...
A single unit type that the player may recruit.
help::section hidden_sections
const unit_type & type() const
This unit's type, accounting for gender and variation.
dimension_measurements layout(int x, int y, int w, int h)
static game_config_manager * get()
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
std::string hidden_symbol(bool hidden)
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.
const game_config_view & game_config() const
std::set< t_translation::terrain_code > & encountered_terrains()
const std::string & id() const
The id for this unit_type.
static lg::log_domain log_display("display")
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_description(const unit &u)
void pump()
Process all events currently in the queue.
void raise_process_event()
const std::string variation_prefix
void show_topic(const std::string &topic_id)
Display the topic with the specified identifier.
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.
int last_num_encountered_units
bool show_variations_in_help() const
Whether the unit type has at least one help-visible variation.
point game_canvas_size()
The size of the game canvas, in drawing coordinates / game pixels.
const game_config_view * game_cfg
std::set< std::string > & encountered_units()
help_manager(const game_config_view *game_config)
const std::string default_show_topic
void generate_contents()
Generate the help contents from the configurations given to the manager.
Standard logging facilities (interface).
const std::string & id() const
Class that keeps track of all the keys on the keyboard.
void draw()
Trigger a draw cycle.
std::string::const_iterator iterator
help::section default_toplevel
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.
static lg::log_domain log_help("help")