From dbb3d626e9dc818b0996a801bb10d2a7c8dc7fea Mon Sep 17 00:00:00 2001 From: Ali El Gariani Date: Tue, 12 May 2009 19:49:02 +0000 Subject: [PATCH] Revert 2009-05-12T17:23:46Z!alinkmaze@gmail.com and rename tile_on_screen to tile_fully_on_screen --- src/display.cpp | 7 ++++--- src/display.hpp | 4 ++-- src/unit_display.cpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index 2c2a2a7613e..9a719481fba 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -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) diff --git a/src/display.hpp b/src/display.hpp index 692cee42fb6..95b0634d8a0 100644 --- a/src/display.hpp +++ b/src/display.hpp @@ -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); diff --git a/src/unit_display.cpp b/src/unit_display.cpp index 31d2d9cb6d4..da4933327c2 100644 --- a/src/unit_display.cpp +++ b/src/unit_display.cpp @@ -173,7 +173,7 @@ void move_unit(const std::vector& 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