Enable the unit and village status information in the editor.

This commit is contained in:
fendrin 2013-05-15 04:40:10 +02:00
parent 4b75e392f7
commit 6d36595f6b
3 changed files with 29 additions and 16 deletions

View file

@ -991,16 +991,16 @@
prefix="" #wmllint: ignore
prefix_literal=""
[/villages]
# [num_units]
# id=num-units
# font_size={DEFAULT_EDITOR_FONT_SMALL}
# ref=units-icon
# rect="+4,=,+55,+16"
# xanchor=fixed
# yanchor=fixed
# prefix="" #wmllint: ignore
# prefix_literal=""
# [/num_units]
[num_units]
id=num-units
font_size={DEFAULT_EDITOR_FONT_SMALL}
ref=units-icon
rect="+4,=,+55,+16"
xanchor=fixed
yanchor=fixed
prefix="" #wmllint: ignore
prefix_literal=""
[/num_units]
# This panel encloses the location information displays and the
# observer icon. This separate container is used so that we can
# make the terrain name display stretch to fill all available space
@ -1062,6 +1062,9 @@
id=mini-map
rect="=+51,=+32,=-14,+131"
[/change]
[remove]
id=map-zoom-slider
[/remove]
[change]
id=zoom_default_button_editor
rect="=-33,=+0,+25,+25"

View file

@ -112,8 +112,15 @@ void editor_display::draw_sidebar()
text = str_cast(mouseoverHex_);
refresh_report("position", &element);
}
text = int(get_map().villages().size());
refresh_report("villages", &element);
if (teams_->empty()) {
text = int(get_map().villages().size());
refresh_report("villages", &element);
} else {
refresh_report("villages");
refresh_report("num_units");
}
text = toolbar_hint_;
refresh_report("editor_tool_hint", &element);

View file

@ -134,8 +134,11 @@ static const unit *get_selected_unit()
static config gray_inactive(const std::string &str)
{
if (resources::screen->viewing_side() == resources::screen->playing_side())
return text_report(str);
if ( (resources::screen &&
(resources::screen->viewing_side() == resources::screen->playing_side()) )
|| !resources::screen )
return text_report(str);
return text_report(span_color(font::GRAY_COLOR) + str + naps);
}
@ -1131,7 +1134,7 @@ REPORT_GENERATOR(gold)
REPORT_GENERATOR(villages)
{
std::ostringstream str;
int viewing_side = resources::screen->viewing_side();
int viewing_side = display::get_singleton()->viewing_side();
const team &viewing_team = (*resources::teams)[viewing_side - 1];
team_data td = calculate_team_data(viewing_team, viewing_side);
str << td.villages << '/';
@ -1150,7 +1153,7 @@ REPORT_GENERATOR(villages)
REPORT_GENERATOR(num_units)
{
return gray_inactive(str_cast(side_units(resources::screen->viewing_side())));
return gray_inactive(str_cast(side_units(display::get_singleton()->viewing_side())));
}
REPORT_GENERATOR(upkeep)