15 #define GETTEXT_DOMAIN "wesnoth-lib"
35 #define LOG_DP LOG_STREAM(info, log_display)
45 , viewing_team_(viewing_team)
46 , selected_side_number_(selected_side_number)
69 listbox& stats_list = find_widget<listbox>(
"game_stats_list");
70 listbox& settings_list = find_widget<listbox>(
"scenario_settings_list");
89 std::string leader_name;
90 std::string leader_image;
94 const bool visible = leader->is_visible_to_team(leader->get_location(),
viewing_team_, see_all);
97 if(visible || known) {
98 leader_image = leader->absolute_image() + leader->image_mods();
99 leader_name = leader->name();
101 leader_image =
formatter() <<
"units/unknown-unit.png" <<
"~RC(magenta>" <<
team.
color() <<
")";
102 leader_name =
_(
"Unknown");
117 column_stats[
"use_markup"] =
"true";
119 column_stats[
"label"] = leader_image;
120 row_data_stats.emplace(
"team_leader_image", column_stats);
124 row_data_stats.emplace(
"team_leader_name", column_stats);
125 column_stats.erase(
"tooltip");
128 row_data_stats.emplace(
"team_name", column_stats);
131 if(known || see_all) {
132 std::string gold_str;
138 row_data_stats.emplace(
"team_gold", column_stats);
140 std::string village_count = std::to_string(
team.
villages().size());
145 column_stats[
"label"] = village_count;
146 row_data_stats.emplace(
"team_villages", column_stats);
148 column_stats[
"label"] = std::to_string(
data.units);
149 row_data_stats.emplace(
"team_units", column_stats);
151 column_stats[
"label"] = std::to_string(
data.upkeep);
152 row_data_stats.emplace(
"team_upkeep", column_stats);
156 row_data_stats.emplace(
"team_income", column_stats);
159 stats_list.
add_row(row_data_stats);
167 column_settings[
"use_markup"] =
"true";
169 column_settings[
"label"] = leader_image;
170 row_data_settings.emplace(
"team_leader_image", column_settings);
173 row_data_settings.emplace(
"team_leader_name", column_settings);
175 column_settings[
"label"] = std::to_string(
team.
side());
176 row_data_settings.emplace(
"team_side", column_settings);
179 row_data_settings.emplace(
"team_start_gold", column_settings);
182 row_data_settings.emplace(
"team_base_income", column_settings);
185 row_data_settings.emplace(
"team_village_gold", column_settings);
188 row_data_settings.emplace(
"team_village_support", column_settings);
191 row_data_settings.emplace(
"team_fog", column_settings);
194 row_data_settings.emplace(
"team_shroud", column_settings);
196 settings_list.
add_row(row_data_settings);
202 return leader ? leader->name().str() :
"";
216 return leader ? leader->name().str() :
"";
230 listbox& tab_bar = find_widget<listbox>(
"tab_bar");
241 const int i = find_widget<listbox>(
"tab_bar").get_selected_row();
243 find_widget<stacked_widget>(
"pager").select_layer(
i);
246 find_widget<label>(
"title").set_label(
247 i == 0 ?
_(
"Current Status") :
_(
"Scenario Settings")
254 const int selected_tab = find_widget<listbox>(
"tab_bar").get_selected_row();
256 const std::string list_id = selected_tab == 0 ?
"game_stats_list" :
"scenario_settings_list";
std::vector< std::string > names
Abstract class for exposing game data that doesn't depend on the GUI, however which for historical re...
virtual const gamemap & map() const =0
virtual const std::vector< team > & teams() const =0
virtual const unit_map & units() const =0
bool show_everything() const
const std::vector< map_location > & villages() const
Return a list of the locations of villages on the map.
unit_const_ptr get_leader(const int side)
const team & viewing_team_
virtual void post_show() override
Actions to be taken after the window has been shown.
int & selected_side_number_
std::vector< team_data > team_data_
const display_context & board_
virtual void pre_show() override
Actions to be taken before showing the window.
Abstract base class for all modal dialogs.
int get_retval() const
Returns the cached window exit code.
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 keyboard_capture(widget *widget)
game_display & get_display() override
Get a reference to a display member a derived class uses.
const std::string & str() const
This class stores all the data for a single 'side' (in game nomenclature).
static std::string get_side_highlight_pango(int side)
const std::string & color() const
const std::string & side_name() const
int village_support() const
const std::string & team_name() const
bool is_enemy(int n) const
const std::set< map_location > & villages() const
bool knows_about_team(std::size_t index) const
static const t_string get_side_color_name_for_UI(unsigned side)
const t_string & user_team_name() const
unit_iterator find_leader(int side)
static lg::log_domain log_display("display")
static std::string _(const char *str)
static std::string controller_name(const team &t)
REGISTER_DIALOG(editor_edit_unit)
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.
std::string tag(const std::string &tag_name, Args &&... contents)
std::string span_color(const color_t &color, Args &&... data)
play_controller * controller
std::string half_signed_value(int val)
Sign with Unicode "−" if negative.
std::string signed_value(int val)
Convert into a signed value (using the Unicode "−" and +0 convention.
@ enemy
Belongs to a non-friendly side; normally visualised by not displaying an orb.
std::shared_ptr< const unit > unit_const_ptr
std::array< T, size()> sized_array
Provide a alias template for an array of matching size.
pointer get_shared_ptr() const
This is exactly the same as operator-> but it's slightly more readable, and can replace &*iter syntax...