15 #define GETTEXT_DOMAIN "wesnoth-lib"
34 #define LOG_DP LOG_STREAM(info, log_display)
44 , viewing_team_(board_.teams()[viewing_team])
45 , selected_side_number_(selected_side_number)
63 return "<span color='#808080'><small>" +
names[
static_cast<int>(
t.controller())] +
"</small></span>";
68 listbox& stats_list = find_widget<listbox>(
"game_stats_list");
69 listbox& settings_list = find_widget<listbox>(
"scenario_settings_list");
88 std::string leader_name;
89 std::string leader_image;
93 const bool visible = leader->is_visible_to_team(leader->get_location(),
viewing_team_, see_all);
96 if(visible || known) {
97 leader_image = leader->absolute_image() + leader->image_mods();
98 leader_name = leader->name();
100 leader_image =
formatter() <<
"units/unknown-unit.png" <<
"~RC(magenta>" <<
team.
color() <<
")";
101 leader_name =
_(
"Unknown");
116 column_stats[
"use_markup"] =
"true";
118 column_stats[
"label"] = leader_image;
119 row_data_stats.emplace(
"team_leader_image", column_stats);
123 row_data_stats.emplace(
"team_leader_name", column_stats);
124 column_stats.erase(
"tooltip");
127 row_data_stats.emplace(
"team_name", column_stats);
130 if(known || see_all) {
131 std::string gold_str;
136 column_stats[
"label"] =
team.
gold() < 0 ?
"<span color='#ff0000'>" + gold_str +
"</span>" : gold_str;
137 row_data_stats.emplace(
"team_gold", column_stats);
139 std::string village_count = std::to_string(
team.
villages().size());
144 column_stats[
"label"] = village_count;
145 row_data_stats.emplace(
"team_villages", column_stats);
147 column_stats[
"label"] = std::to_string(
data.units);
148 row_data_stats.emplace(
"team_units", column_stats);
150 column_stats[
"label"] = std::to_string(
data.upkeep);
151 row_data_stats.emplace(
"team_upkeep", column_stats);
154 column_stats[
"label"] =
data.net_income < 0 ?
"<span color='#ff0000'>" + income +
"</span>" : income;
155 row_data_stats.emplace(
"team_income", column_stats);
158 stats_list.
add_row(row_data_stats);
166 column_settings[
"use_markup"] =
"true";
168 column_settings[
"label"] = leader_image;
169 row_data_settings.emplace(
"team_leader_image", column_settings);
172 row_data_settings.emplace(
"team_leader_name", column_settings);
174 column_settings[
"label"] = std::to_string(
team.
side());
175 row_data_settings.emplace(
"team_side", column_settings);
178 row_data_settings.emplace(
"team_start_gold", column_settings);
181 row_data_settings.emplace(
"team_base_income", column_settings);
184 row_data_settings.emplace(
"team_village_gold", column_settings);
187 row_data_settings.emplace(
"team_village_support", column_settings);
190 row_data_settings.emplace(
"team_fog", column_settings);
193 row_data_settings.emplace(
"team_shroud", column_settings);
195 settings_list.
add_row(row_data_settings);
201 return leader ? leader->name().str() :
"";
215 return leader ? leader->name().str() :
"";
229 listbox& tab_bar = find_widget<listbox>(
"tab_bar");
240 const int i = find_widget<listbox>(
"tab_bar").get_selected_row();
242 find_widget<stacked_widget>(
"pager").select_layer(
i);
245 find_widget<label>(
"title").set_label(
246 i == 0 ?
_(
"Current Status") :
_(
"Scenario Settings")
253 const int selected_tab = find_widget<listbox>(
"tab_bar").get_selected_row();
255 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.
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...