Skip to content

Commit

Permalink
Fixed forcing full map update on city map
Browse files Browse the repository at this point in the history
  • Loading branch information
mir3x committed Nov 11, 2020
1 parent 8969938 commit 9bd5b4a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
10 changes: 7 additions & 3 deletions client/gui-qt/citydlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2893,8 +2893,7 @@ void qtg_real_city_dialog_popup(struct city *pcity)
city_dialog::instance()->show();
city_dialog::instance()->activateWindow();
city_dialog::instance()->raise();
dirty_all();
flush_dirty();
map_canvas_resized(mapview.width, mapview.height);
}

/************************************************************************/ /**
Expand All @@ -2913,12 +2912,17 @@ void destroy_city_dialog()
void qtg_popdown_city_dialog(struct city *pcity)
{
city_dialog::instance()->hide();
map_canvas_resized(mapview.width, mapview.height);
}

/************************************************************************/ /**
Close the dialogs for all cities.
****************************************************************************/
void qtg_popdown_all_city_dialogs() { destroy_city_dialog(); }
void qtg_popdown_all_city_dialogs()
{
destroy_city_dialog();
map_canvas_resized(mapview.width, mapview.height);
}

/************************************************************************/ /**
Refresh (update) all data for the given city's dialog.
Expand Down
15 changes: 6 additions & 9 deletions client/mapview_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ void put_drawn_sprites(struct canvas *pcanvas, float zoom, int canvas_x,
}
}
}
#include <QDebug>

/************************************************************************/ /**
Draw one layer of a tile, edge, corner, unit, and/or city onto the
canvas at the given position.
Expand All @@ -1341,10 +1341,9 @@ void put_one_element(struct canvas *pcanvas, float zoom,
if (ptile) {
struct city *xcity = is_any_city_dialog_open();
if (xcity) {
// Attack of dummies !
int dummy_x, dummy_y;
//struct city *xcity = find_city_near_tile(ptile);
if (xcity
&& !city_base_to_city_map(&dummy_x, &dummy_y, xcity, ptile)) {
if (!city_base_to_city_map(&dummy_x, &dummy_y, xcity, ptile)) {
city_mode = true;
}
}
Expand Down Expand Up @@ -3620,11 +3619,9 @@ bool map_canvas_resized(int width, int height)
mapview.store_width = full_width;
mapview.store_height = full_height;

/* Check for what's changed. */
tile_size_changed =
(tile_width != old_tile_width || tile_height != old_tile_height);
size_changed = (width != old_width || height != old_height);

/* use that function to clear cache */
tile_size_changed = true;
size_changed = true;
/* If the tile size has changed, resize the canvas. */
if (tile_size_changed) {
if (mapview.store) {
Expand Down

0 comments on commit 9bd5b4a

Please sign in to comment.