Further deploy display::get_location_rect

This commit is contained in:
Charles Dang 2024-09-23 09:55:53 -04:00
parent 85309bd93c
commit 09e7ed97e8
2 changed files with 3 additions and 9 deletions

View file

@ -53,11 +53,7 @@ void mouse_action_unit::move(editor_display& disp, const map_location& hex)
disp.clear_mouseover_hex_overlay();
SDL_Rect rect;
rect.x = disp.get_location_x(hex);
rect.y = disp.get_location_y(hex);
rect.h = disp.hex_size();
rect.w = disp.hex_size();
SDL_Rect rect = disp.get_location_rect(hex);
std::stringstream str;
str << _("Identifier: ") << unit_it->id() << "\n";
if(unit_it->name() != "") {

View file

@ -191,10 +191,8 @@ void halo_impl::effect::update()
if(map_loc_.x != -1 && map_loc_.y != -1) {
// If the halo is attached to a particular map location,
// make sure it stays attached.
set_location(
disp->get_location_x(map_loc_) + disp->hex_size() / 2,
disp->get_location_y(map_loc_) + disp->hex_size() / 2
);
auto [x, y] = disp->get_location_rect(map_loc_).center();
set_location(x, y);
} else {
// It would be good to attach to a position within a hex,
// or persistently to an item or unit. That's not the case,