15 #define GETTEXT_DOMAIN "wesnoth-lib" 43 #define LOG_DP LOG_STREAM(info, log_display) 53 , viewing_team_(board_.teams()[viewing_team])
54 , selected_side_number_(selected_side_number)
72 return "<span color='#808080'><small>" +
names[
static_cast<int>(t.
controller())] +
"</small></span>";
77 listbox& stats_list = find_widget<listbox>(&
window,
"game_stats_list",
false);
78 listbox& settings_list = find_widget<listbox>(&
window,
"scenario_settings_list",
false);
97 std::string leader_name;
98 std::string leader_image;
102 const bool visible = leader->is_visible_to_team(leader->get_location(),
viewing_team_, see_all);
105 if(visible || known) {
106 leader_image = leader->absolute_image() + leader->image_mods();
107 leader_name = leader->name();
109 leader_image =
formatter() <<
"units/unknown-unit.png" <<
"~RC(magenta>" <<
team.
color() <<
")";
110 leader_name =
_(
"Unknown");
125 column_stats[
"use_markup"] =
"true";
127 column_stats[
"label"] = leader_image;
128 row_data_stats.emplace(
"team_leader_image", column_stats);
132 row_data_stats.emplace(
"team_leader_name", column_stats);
133 column_stats.erase(
"tooltip");
136 row_data_stats.emplace(
"team_name", column_stats);
139 if(known || see_all) {
140 std::string gold_str;
145 column_stats[
"label"] =
team.
gold() < 0 ?
"<span color='#ff0000'>" + gold_str +
"</span>" : gold_str;
146 row_data_stats.emplace(
"team_gold", column_stats);
148 std::string village_count = std::to_string(
team.
villages().size());
153 column_stats[
"label"] = village_count;
154 row_data_stats.emplace(
"team_villages", column_stats);
156 column_stats[
"label"] = std::to_string(data.
units);
157 row_data_stats.emplace(
"team_units", column_stats);
159 column_stats[
"label"] = std::to_string(data.
upkeep);
160 row_data_stats.emplace(
"team_upkeep", column_stats);
163 column_stats[
"label"] = data.
net_income < 0 ?
"<span color='#ff0000'>" + income +
"</span>" : income;
164 row_data_stats.emplace(
"team_income", column_stats);
167 stats_list.
add_row(row_data_stats);
175 column_settings[
"use_markup"] =
"true";
177 column_settings[
"label"] = leader_image;
178 row_data_settings.emplace(
"team_leader_image", column_settings);
181 row_data_settings.emplace(
"team_leader_name", column_settings);
183 column_settings[
"label"] = std::to_string(
team.
side());
184 row_data_settings.emplace(
"team_side", column_settings);
187 row_data_settings.emplace(
"team_start_gold", column_settings);
190 row_data_settings.emplace(
"team_base_income", column_settings);
193 row_data_settings.emplace(
"team_village_gold", column_settings);
196 row_data_settings.emplace(
"team_village_support", column_settings);
199 row_data_settings.emplace(
"team_fog", column_settings);
202 row_data_settings.emplace(
"team_shroud", column_settings);
204 settings_list.add_row(row_data_settings);
210 return leader ? leader->name().str() :
"";
222 settings_list.register_translatable_sorting_option(0, [
this](
const int i) {
224 return leader ? leader->name().str() :
"";
227 settings_list.register_sorting_option(1, [
this](
const int i) {
return board_.
teams()[
i].side(); });
228 settings_list.register_sorting_option(2, [
this](
const int i) {
return board_.
teams()[
i].start_gold(); });
229 settings_list.register_sorting_option(3, [
this](
const int i) {
return board_.
teams()[
i].base_income(); });
230 settings_list.register_sorting_option(4, [
this](
const int i) {
return board_.
teams()[
i].village_gold(); });
231 settings_list.register_sorting_option(5, [
this](
const int i) {
return board_.
teams()[
i].village_support(); });
232 settings_list.register_sorting_option(6, [
this](
const int i) {
return board_.
teams()[
i].uses_fog(); });
233 settings_list.register_sorting_option(7, [
this](
const int i) {
return board_.
teams()[
i].uses_shroud(); });
238 listbox& tab_bar = find_widget<listbox>(&
window,
"tab_bar",
false);
240 window.keyboard_capture(&tab_bar);
249 const int i = find_widget<listbox>(
get_window(),
"tab_bar",
false).get_selected_row();
251 find_widget<stacked_widget>(
get_window(),
"pager",
false).select_layer(i);
255 i == 0 ?
_(
"Current Status") :
_(
"Scenario Settings")
262 const int selected_tab = find_widget<listbox>(&
window,
"tab_bar",
false).get_selected_row();
264 const std::string list_id = selected_tab == 0 ?
"game_stats_list" :
"scenario_settings_list";
Define the common log macros for the gui toolkit.
window(const builder_window::window_resolution &definition)
< Needs to be initialized in show.
play_controller * controller
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
const std::string & side_name() const
unit_iterator find_leader(int side)
game_display & get_display() override
Get a reference to a display member a derived class uses.
bool show_everything() const
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.
static std::string _(const char *str)
virtual const gamemap & map() const =0
int village_support() const
static std::string get_side_highlight_pango(int side)
const team & viewing_team_
static const t_string get_side_color_name_for_UI(unsigned side)
bool knows_about_team(std::size_t index) const
std::shared_ptr< const unit > unit_const_ptr
This class stores all the data for a single 'side' (in game nomenclature).
Belongs to a non-friendly side; normally visualised by not displaying an orb.
std::string half_signed_value(int val)
Sign with Unicode "−" if negative.
std::map< std::string, t_string > widget_item
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
side_controller::type controller() const
This file contains the settings handling of the widget library.
std::array< T, size()> sized_array
Provide a alias template for an array of matching size.
bool is_enemy(int n) const
map_display and display: classes which take care of displaying the map and game-data on the screen...
virtual const unit_map & units() const =0
window * get_window()
Returns a pointer to the dialog's window.
pointer get_shared_ptr() const
This is exactly the same as operator-> but it's slightly more readable, and can replace &*iter syntax...
virtual const std::vector< team > & teams() const =0
int & selected_side_number_
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
std::vector< std::string > names
std::vector< team_data > team_data_
int get_retval() const
Returns the cached window exit code.
const std::string & color() const
const std::vector< map_location > & villages() const
Return a list of the locations of villages on the map.
Abstract base class for all modal dialogs.
unit_const_ptr get_leader(const int side)
static lg::log_domain log_display("display")
std::map< std::string, widget_item > widget_data
std::string signed_value(int val)
Convert into a signed value (using the Unicode "−" and +0 convention.
Dialog was closed with the OK button.
void register_sorting_option(const int col, const Func &f)
const std::string & str() const
const std::set< map_location > & villages() const
base class of top level items, the only item which needs to store the final canvases to draw on...
const std::string & team_name() const
const t_string & user_team_name() const
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification &signal)
Connects a signal handler for getting a notification upon modification.
static std::string controller_name(const team &t)
const display_context & board_