Make 'none' a special case for [unit_type]ellipse (bug #21724)

This commit is contained in:
Alexander van Gessel 2014-02-28 20:59:22 +01:00
parent cb86f5e868
commit 1c528a7a37
3 changed files with 15 additions and 11 deletions

View file

@ -18,6 +18,7 @@ Version 1.11.10+dev:
* Non-team labels no longer remove team labels that were present in the
same hex.
* New colors for the Light Red and Dark Red minimap markers.
* Bug #21724: 'none' is now a special case for [unit_type] ellipse
* Miscellaneous and bug fixes:
* Units can no longer be moved in linger mode (bug #21450).
* Changed: Updated valgrind suppression file.

View file

@ -258,6 +258,7 @@ Xu, Xu, Qxu, Qxu, Ql, Ql, Ql, Xu, Xu, Xu, Xu, Xu, Xu, Xu, Xu, Gg, Gg, Gg, Gg, Gg
generate_name=yes
hitpoints=4
vision=15
ellipse=none
[status]
petrified=yes
[/status]

View file

@ -2015,19 +2015,21 @@ void unit::redraw_unit()
ellipse="misc/ellipse";
}
// check if the unit has a ZoC or can recruit
const char* const nozoc = emit_zoc_ ? "" : "nozoc-";
const char* const leader = can_recruit() ? "leader-" : "";
const char* const selected = disp.selected_hex() == loc_ ? "selected-" : "";
if(ellipse != "none") {
// check if the unit has a ZoC or can recruit
const char* const nozoc = emit_zoc_ ? "" : "nozoc-";
const char* const leader = can_recruit() ? "leader-" : "";
const char* const selected = disp.selected_hex() == loc_ ? "selected-" : "";
// Load the ellipse parts recolored to match team color
char buf[100];
std::string tc=team::get_side_color_index(side_);
// Load the ellipse parts recolored to match team color
char buf[100];
std::string tc=team::get_side_color_index(side_);
snprintf(buf,sizeof(buf),"%s-%s%s%stop.png~RC(ellipse_red>%s)",ellipse.c_str(),leader,nozoc,selected,tc.c_str());
ellipse_back.assign(image::get_image(image::locator(buf), image::SCALED_TO_ZOOM));
snprintf(buf,sizeof(buf),"%s-%s%s%sbottom.png~RC(ellipse_red>%s)",ellipse.c_str(),leader,nozoc,selected,tc.c_str());
ellipse_front.assign(image::get_image(image::locator(buf), image::SCALED_TO_ZOOM));
snprintf(buf,sizeof(buf),"%s-%s%s%stop.png~RC(ellipse_red>%s)",ellipse.c_str(),leader,nozoc,selected,tc.c_str());
ellipse_back.assign(image::get_image(image::locator(buf), image::SCALED_TO_ZOOM));
snprintf(buf,sizeof(buf),"%s-%s%s%sbottom.png~RC(ellipse_red>%s)",ellipse.c_str(),leader,nozoc,selected,tc.c_str());
ellipse_front.assign(image::get_image(image::locator(buf), image::SCALED_TO_ZOOM));
}
}
if (ellipse_back != NULL) {