add bar_offset_x/y to [unit_type]
this should probably be opimized later so that it does not need the config lookup on each redraw, but that can be done 1.13.12
This commit is contained in:
parent
cdd1cb692b
commit
ff31a99aa2
1 changed files with 16 additions and 3 deletions
|
@ -224,9 +224,22 @@ void unit_drawer::redraw_unit (const unit & u) const
|
|||
}
|
||||
if(draw_bars) {
|
||||
const image::locator* orb_img = nullptr;
|
||||
const surface unit_img = image::get_image(u.default_anim_image(), image::SCALED_TO_ZOOM);
|
||||
const int xoff = unit_img.null() ? hex_size_by_2 : (hex_size - unit_img->w)/2;
|
||||
const int yoff = unit_img.null() ? hex_size_by_2 : (hex_size - unit_img->h)/2;
|
||||
|
||||
const auto& type_cfg = u.type().get_cfg();
|
||||
const auto& cfg_offset_x = type_cfg["bar_offset_x"];
|
||||
const auto& cfg_offset_y = type_cfg["bar_offset_y"];
|
||||
int xoff;
|
||||
int yoff;
|
||||
if(cfg_offset_x.empty() && cfg_offset_y.empty()) {
|
||||
const surface unit_img = image::get_image(u.default_anim_image(), image::SCALED_TO_ZOOM);
|
||||
xoff = unit_img.null() ? 0 : (hex_size - unit_img->w)/2;
|
||||
yoff = unit_img.null() ? 0 : (hex_size - unit_img->h)/2;
|
||||
}
|
||||
else {
|
||||
xoff = cfg_offset_x.to_int();
|
||||
yoff = cfg_offset_y.to_int();
|
||||
}
|
||||
|
||||
/*static*/ const image::locator partmoved_orb(game_config::images::orb + "~RC(magenta>" +
|
||||
preferences::partial_color() + ")" );
|
||||
/*static*/ const image::locator moved_orb(game_config::images::orb + "~RC(magenta>" +
|
||||
|
|
Loading…
Add table
Reference in a new issue