15 #define GETTEXT_DOMAIN "wesnoth-lib"
33 #define LOG_DP LOG_STREAM(info, log_display)
43 , scroll_to_(scroll_to)
51 }
else if(
level == 1) {
52 return std::to_string(
level);
53 }
else if(
level == 2) {
69 const int moves_max = u->total_movement();
71 std::string color =
"#00ff00";
83 listbox& list = find_widget<listbox>(
"units_list");
95 column[
"use_markup"] =
"true";
98 row_data.emplace(
"unit_type", column);
101 column[
"label"] = name;
102 row_data.emplace(
"unit_name", column);
105 row_data.emplace(
"unit_moves", column);
107 std::stringstream hp_str;
110 column[
"label"] = hp_str.str();
111 row_data.emplace(
"unit_hp", column);
114 row_data.emplace(
"unit_level", column);
121 row_data.emplace(
"unit_experience", column);
124 row_data.emplace(
"unit_traits", column);
164 const int selected_row
165 = find_widget<listbox>(
"units_list").get_selected_row();
167 if(selected_row == -1) {
171 find_widget<unit_preview_pane>(
"unit_details")
178 const int selected_row = find_widget<listbox>(
"units_list").get_selected_row();
191 if(
i->side() !=
gui.viewing_team().side()) {
200 gui.select_hex(scroll_to);
Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.
Abstract base class for all modal dialogs.
int get_retval() const
Returns the cached window exit code.
virtual void post_show() override
Actions to be taken after the window has been shown.
virtual void pre_show() override
Actions to be taken before showing the window.
map_location & scroll_to_
std::vector< unit_const_ptr > & unit_list_
void list_item_clicked()
Callbacks.
static bool execute(std::vector< unit_const_ptr > &units, map_location &scroll_to)
grid & add_row(const widget_item &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
void register_translatable_sorting_option(const int col, translatable_sorter_func_t f)
Registers a special sorting function specifically for translatable values.
void register_sorting_option(const int col, const Func &f)
void clear()
Removes all the rows in the listbox, clearing it.
void keyboard_capture(widget *widget)
const std::string & str() const
Container associating units to locations.
This class represents a single unit of a specific type.
map_display and display: classes which take care of displaying the map and game-data on the screen.
bool invisible(const map_location &loc, bool see_all=true) const
int max_hitpoints() const
The max number of hitpoints this unit can have.
int level() const
The current level of this unit.
const t_string & type_name() const
Gets the translatable name of this unit's type.
int hitpoints() const
The current number of hitpoints this unit has.
bool get_state(const std::string &state) const
Check if the unit is affected by a status effect.
int experience() const
The current number of experience points this unit has.
unsigned int experience_to_advance() const
The number of experience points this unit needs to level up, or 0 if current XP > max XP.
int max_experience() const
The max number of experience points this unit can have.
const t_string & name() const
Gets this unit's translatable display name.
@ STATE_PETRIFIED
The unit is poisoned - it loses health each turn.
@ STATE_POISONED
The unit is slowed - it moves slower and does less damage.
bool can_advance() const
Checks whether this unit has any options to advance to.
color_t xp_color() const
Color for this unit's XP.
color_t hp_color() const
Color for this unit's current hitpoints.
const map_location & get_location() const
The current map location this unit is at.
const std::vector< t_string > & trait_names() const
Gets the names of the currently registered traits.
const std::string unicode_en_dash
static std::string format_level_string(const int level)
static std::string format_if_leader(unit_const_ptr u, const std::string &str)
static std::string format_movement_string(unit_const_ptr u)
REGISTER_DIALOG(editor_edit_unit)
void show_unit_list(display &gui)
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification &signal)
Connects a signal handler for getting a notification upon modification.
std::map< std::string, widget_item > widget_data
std::map< std::string, t_string > widget_item
@ OK
Dialog was closed with the OK button.
Functions to load and save images from/to disk.
std::string bold(Args &&... data)
std::string span_color(const color_t &color, Args &&... data)
std::string join(const T &v, const std::string &s=",")
Generates a new string joining container items in a list.
std::shared_ptr< const unit > unit_const_ptr
Encapsulates the map of the game.
static lg::log_domain log_display("display")