Skip to content

Commit

Permalink
Remove center_tile
Browse files Browse the repository at this point in the history
We can recalculate this on the fly whenever we need it, which is not very
often.
  • Loading branch information
lmoureaux committed Jul 30, 2022
1 parent 50231de commit e978e66
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions client/mapview_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ Q_GLOBAL_STATIC(gotohash, mapdeco_gotoline)
struct view mapview;
bool can_slide = true;

struct tile *center_tile = nullptr;

static void base_canvas_to_map_pos(int *map_x, int *map_y, float canvas_x,
float canvas_y);

Expand Down Expand Up @@ -816,8 +814,6 @@ void center_tile_mapcanvas(struct tile *ptile)
gui_y -= (mapview.height - tileset_tile_height(tileset)) / 2;

set_mapview_origin(gui_x, gui_y);

center_tile = ptile;
}

/**
Expand Down Expand Up @@ -2489,6 +2485,9 @@ void mapdeco_clear_gotoroutes()
*/
void map_canvas_resized(int width, int height)
{
// Save the current center before we resize
const auto center_tile = get_center_tile_mapcanvas();

int tile_width = (width + tileset_tile_width(tileset) - 1)
/ (tileset_tile_width(tileset));
int tile_height = (height + tileset_tile_height(tileset) - 1)
Expand Down

0 comments on commit e978e66

Please sign in to comment.