Added a check to change a unit's ellipse depending on its ZoC
This modification allows the game to automatically select the unit's ellipse, by checking if said unit emits a ZoC; if the unit loses or gains it, due for example to a level-up or to the Stun ability, the ellipse will change accordingly. This effectively makes no longer useful declaring the ellipse in a unit's .cfg file.
This commit is contained in:
parent
ec62bf4329
commit
2ab95a2764
1 changed files with 4 additions and 2 deletions
|
@ -1947,6 +1947,8 @@ 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-" : "";
|
||||
|
||||
|
@ -1954,9 +1956,9 @@ void unit::redraw_unit()
|
|||
char buf[100];
|
||||
std::string tc=team::get_side_color_index(side_);
|
||||
|
||||
snprintf(buf,sizeof(buf),"%s-%s%stop.png~RC(ellipse_red>%s)",ellipse.c_str(),leader,selected,tc.c_str());
|
||||
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%sbottom.png~RC(ellipse_red>%s)",ellipse.c_str(),leader,selected,tc.c_str());
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue