20 #define GETTEXT_DOMAIN "wesnoth-help" 40 #include "widgets/button.hpp" 50 #define WRN_DP LOG_STREAM(warn, log_display) 53 #define ERR_HELP LOG_STREAM(err, log_help) 69 std::string var_id = t.
get_cfg()[
"variation_id"].str();
71 var_id = t.
get_cfg()[
"variation_name"].str();
73 bool use_variation =
false;
74 if (!var_id.empty()) {
115 void show_help(
const std::string& show_topic,
int xloc,
int yloc)
125 void show_unit_help(
const std::string& show_topic,
bool has_variations,
bool hidden,
int xloc,
int yloc)
156 const std::string& show_topic,
175 if (yloc <= -1 || xloc <= -1) {
176 xloc = screen_area.w / 2 - width / 2;
177 yloc = screen_area.h / 2 - height / 2;
179 std::vector<gui::button*> buttons_ptr;
181 buttons_ptr.push_back(&close_button_);
185 f.
layout(xloc, yloc, width, height);
204 hb.
set_location(xloc + left_padding, yloc + top_padding);
205 hb.
set_width(width - left_padding - right_padding);
206 hb.
set_height(height - top_padding - bot_padding);
207 if (!show_topic.empty()) {
221 if (key[SDLK_ESCAPE]) {
226 button_it != buttons_ptr.end(); ++button_it) {
227 if ((*button_it)->pressed()) {
237 ERR_HELP <<
_(
"Parse error when parsing help text:") <<
" " << e.
message << std::endl;
240 std::stringstream
msg;
241 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.
boost::tribool last_debug_state
int relative_size(int size)
void flip()
Renders the screen.
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, const bool restore_background)
Shows a transient message to the user.
Thrown when the help system fails to parse something.
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 CVideo & get_singleton()
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
const std::string terrain_prefix
int last_num_encountered_terrains
Definitions for the interface to Wesnoth Markup Language (WML).
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)
help_manager(const config *game_config)
static UNUSEDNOWARN std::string _(const char *str)
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
std::string hidden_symbol(bool hidden)
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 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.
std::set< std::string > & encountered_units()
bool hide_in_editor() const
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
static void delay(unsigned int milliseconds)
Waits a given number of milliseconds before returning.
A config object defines a single node in a WML file, with access to child nodes.
Class that keeps track of all the keys on the keyboard.
SDL_Rect screen_area(bool as_pixels=true) const
Returns the current window renderer area, either in pixels or screen coordinates. ...
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")