fixes a small offset problem.

It's not really noticable but will be once the new centering code will
be committed.
This commit is contained in:
Mark de Wever 2007-05-26 13:10:55 +00:00
parent 755cd37630
commit a3e0e197f1

View file

@ -369,6 +369,14 @@ gamemap::location display::pixel_position_to_hex(int x, int y, gamemap::location
void display::get_rect_hex_bounds(SDL_Rect rect, gamemap::location &topleft, gamemap::location &bottomright) const
{
// change the coordinates of the rect send to be relative
// to the map area instead of the screen area
const SDL_Rect& map_rect = map_area();
rect.x -= map_rect.x;
rect.y -= map_rect.y;
rect.w += map_rect.x;
rect.h += map_rect.y;
const int tile_width = hex_width();
topleft.x = (xpos_ + rect.x) / tile_width;