mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-24 19:55:07 +00:00
Remove display::get_location_x|y
This commit is contained in:
parent
9f806362ae
commit
0e8edd12e4
@ -679,21 +679,11 @@ bool display::fogged(const map_location& loc) const
|
||||
return is_blindfolded() || (dont_show_all_ && viewing_team().fogged(loc));
|
||||
}
|
||||
|
||||
int display::get_location_x(const map_location& loc) const
|
||||
{
|
||||
return static_cast<int>(map_area().x + (loc.x + theme_.border().size) * hex_width() - viewport_origin_.x);
|
||||
}
|
||||
|
||||
int display::get_location_y(const map_location& loc) const
|
||||
{
|
||||
return static_cast<int>(map_area().y + (loc.y + theme_.border().size) * zoom_ - viewport_origin_.y + (is_odd(loc.x) ? zoom_/2 : 0));
|
||||
}
|
||||
|
||||
point display::get_location(const map_location& loc) const
|
||||
{
|
||||
return {
|
||||
get_location_x(loc),
|
||||
get_location_y(loc)
|
||||
static_cast<int>(map_area().x + (loc.x + theme_.border().size) * hex_width() - viewport_origin_.x),
|
||||
static_cast<int>(map_area().y + (loc.y + theme_.border().size) * zoom_ - viewport_origin_.y + (is_odd(loc.x) ? zoom_/2 : 0))
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -316,8 +316,6 @@ public:
|
||||
void invalidate_game_status() { invalidateGameStatus_ = true; }
|
||||
|
||||
/** Functions to get the on-screen positions of hexes. */
|
||||
int get_location_x(const map_location& loc) const;
|
||||
int get_location_y(const map_location& loc) const;
|
||||
point get_location(const map_location& loc) const;
|
||||
|
||||
/** Returns the on-screen rect corresponding to a @a loc */
|
||||
|
@ -579,10 +579,12 @@ void game_display::float_label(const map_location& loc, const std::string& text,
|
||||
return;
|
||||
}
|
||||
|
||||
rect loc_rect = get_location_rect(loc);
|
||||
|
||||
font::floating_label flabel(text);
|
||||
flabel.set_font_size(int(font::SIZE_FLOAT_LABEL * get_zoom_factor()));
|
||||
flabel.set_color(color);
|
||||
flabel.set_position(get_location_x(loc)+zoom_/2, get_location_y(loc));
|
||||
flabel.set_position(loc_rect.center().x, loc_rect.y); // middle of top edge
|
||||
flabel.set_move(0, -0.1 * turbo_speed() * get_zoom_factor());
|
||||
flabel.set_lifetime(1000/turbo_speed());
|
||||
flabel.set_scroll_mode(font::ANCHOR_LABEL_MAP);
|
||||
|
@ -537,8 +537,8 @@ void terrain_label::recalculate()
|
||||
// Note: the y part of loc_nextx is not used at all.
|
||||
const map_location loc_nextx = loc_.get_direction(map_location::direction::north_east);
|
||||
const map_location loc_nexty = loc_.get_direction(map_location::direction::south);
|
||||
const int xloc = (disp->get_location_x(loc_) + disp->get_location_x(loc_nextx) * 2) / 3;
|
||||
const int yloc = disp->get_location_y(loc_nexty) - scale_to_map_zoom(font::SIZE_NORMAL);
|
||||
const int xloc = (disp->get_location(loc_).x + disp->get_location(loc_nextx).x * 2) / 3;
|
||||
const int yloc = disp->get_location(loc_nexty).y - scale_to_map_zoom(font::SIZE_NORMAL);
|
||||
|
||||
// If a color is specified don't allow to override it with markup. (prevents faking map labels for example)
|
||||
// FIXME: @todo Better detect if it's team label and not provided by the scenario.
|
||||
|
Loading…
x
Reference in New Issue
Block a user