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);
201 [
this](
const std::size_t
i) {
203 return leader ? leader->name() :
t_string();
205 [
this](
const std::size_t
i) {
return board_.
teams()[
i].user_team_name(); },
206 [
this](
const std::size_t
i) {
return board_.
teams()[
i].gold(); },
207 [
this](
const std::size_t
i) {
return board_.
teams()[
i].villages(); },
208 [
this](
const std::size_t
i) {
return team_data_[
i].units; },
209 [
this](
const std::size_t
i) {
return team_data_[
i].upkeep; },
210 [
this](
const std::size_t
i) {
return team_data_[
i].net_income; }
215 [
this](
const std::size_t
i) {
217 return leader ? leader->name() :
t_string();
219 [
this](
const std::size_t
i) {
return board_.
teams()[
i].side(); },
220 [
this](
const std::size_t
i) {
return board_.
teams()[
i].start_gold(); },
221 [
this](
const std::size_t
i) {
return board_.
teams()[
i].base_income(); },
222 [
this](
const std::size_t
i) {
return board_.
teams()[
i].village_gold(); },
223 [
this](
const std::size_t
i) {
return board_.
teams()[
i].village_support(); },
224 [
this](
const std::size_t
i) {
return board_.
teams()[
i].uses_fog(); },
225 [
this](
const std::size_t
i) {
return board_.
teams()[
i].uses_shroud(); }
231 listbox& tab_bar = find_widget<listbox>(
"tab_bar");
242 const int i = find_widget<listbox>(
"tab_bar").get_selected_row();
244 find_widget<stacked_widget>(
"pager").select_layer(
i);
247 find_widget<label>(
"title").set_label(
248 i == 0 ?
_(
"Current Status") :
_(
"Scenario Settings")
255 const int selected_tab = find_widget<listbox>(
"tab_bar").get_selected_row();
257 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 set_sorters(Args &&... functors)
Registers sorting controls using magic index IDs.
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...