mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-26 19:39:31 +00:00
Revert 2009-05-12T17:23:46Z!alinkmaze@gmail.com and rename tile_on_screen to tile_fully_on_screen
This commit is contained in:
parent
a9022dfb3b
commit
dbb3d626e9
@ -1548,10 +1548,11 @@ void display::set_default_zoom()
|
||||
}
|
||||
}
|
||||
|
||||
bool display::tile_on_screen(const map_location& loc)
|
||||
bool display::tile_fully_on_screen(const map_location& loc)
|
||||
{
|
||||
SDL_Rect r = { get_location_x(loc), get_location_y(loc), hex_size(), hex_size()};
|
||||
return rects_overlap(r, map_area());
|
||||
int x = get_location_x(loc);
|
||||
int y = get_location_y(loc);
|
||||
return !outside_area(map_area(), x, y);
|
||||
}
|
||||
|
||||
bool display::tile_nearly_on_screen(const map_location& loc)
|
||||
|
@ -436,8 +436,8 @@ public:
|
||||
/** Expose the event, so observers can be notified about map scrolling. */
|
||||
events::generic_event &scroll_event() const { return scroll_event_; }
|
||||
|
||||
/** Check if a tile is fully on screen. */
|
||||
bool tile_on_screen(const map_location& loc);
|
||||
/** Check if a tile is fully visible on screen. */
|
||||
bool tile_fully_on_screen(const map_location& loc);
|
||||
|
||||
/** Checks if location @a loc or one of the adjacent tiles is visible on screen. */
|
||||
bool tile_nearly_on_screen(const map_location &loc);
|
||||
|
@ -173,7 +173,7 @@ void move_unit(const std::vector<map_location>& path, unit& u, const std::vector
|
||||
temp_unit.invisible(path[i+1],units,teams);
|
||||
|
||||
if(!invisible) {
|
||||
if (!disp->tile_on_screen(path[i]) || !disp->tile_on_screen(path[i+1])) {
|
||||
if (!disp->tile_fully_on_screen(path[i]) || !disp->tile_fully_on_screen(path[i+1])) {
|
||||
// prevent the unit from dissappearing if we scroll here with i == 0
|
||||
disp->place_temporary_unit(temp_unit,path[i]);
|
||||
// scroll in as much of the remaining path as possible
|
||||
|
Loading…
x
Reference in New Issue
Block a user