From 2349cf1981bfd1e44d612a19131f65d6b41abbe8 Mon Sep 17 00:00:00 2001 From: "Ignacio R. Morelle" Date: Sun, 1 Jun 2014 23:39:58 -0400 Subject: [PATCH] Revert "Prevent minimap scrolling if viewport is locked" This reverts commit 2f8b997cb8a093b71a54a64e47b3c9d4a826885f. This needs to be redone in a less sloppy way that doesn't functions not returning an actual value per their declaration or mass code reindentations. --- src/display.cpp | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index aa0e511732a3..05b354a48bec 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -795,35 +795,32 @@ int display::get_location_y(const map_location& loc) const map_location display::minimap_location_on(int x, int y) { - if(!view_locked_ || force) { + //TODO: don't return location for this, + // instead directly scroll to the clicked pixel position - //TODO: don't return location for this, - // instead directly scroll to the clicked pixel position - - if (!point_in_rect(x, y, minimap_area())) { - return map_location(); - } + if (!point_in_rect(x, y, minimap_area())) { + return map_location(); + } - // we transform the coordinates from minimap to the full map image - // probably more adjustments to do (border, minimap shift...) - // but the mouse and human capacity to evaluate the rectangle center - // is not pixel precise. - int px = (x - minimap_location_.x) * get_map().w()*hex_width() / minimap_location_.w; - int py = (y - minimap_location_.y) * get_map().h()*hex_size() / minimap_location_.h; + // we transform the coordinates from minimap to the full map image + // probably more adjustments to do (border, minimap shift...) + // but the mouse and human capacity to evaluate the rectangle center + // is not pixel precise. + int px = (x - minimap_location_.x) * get_map().w()*hex_width() / minimap_location_.w; + int py = (y - minimap_location_.y) * get_map().h()*hex_size() / minimap_location_.h; - map_location loc = pixel_position_to_hex(px, py); - if (loc.x < 0) - loc.x = 0; - else if (loc.x >= get_map().w()) - loc.x = get_map().w() - 1; + map_location loc = pixel_position_to_hex(px, py); + if (loc.x < 0) + loc.x = 0; + else if (loc.x >= get_map().w()) + loc.x = get_map().w() - 1; - if (loc.y < 0) - loc.y = 0; - else if (loc.y >= get_map().h()) - loc.y = get_map().h() - 1; + if (loc.y < 0) + loc.y = 0; + else if (loc.y >= get_map().h()) + loc.y = get_map().h() - 1; - return loc; - } + return loc; } int display::screenshot(std::string filename, bool map_screenshot)