Skip to content

Commit

Permalink
Fix saving hexagonal maps to image
Browse files Browse the repository at this point in the history
The calculated image size was never exactly matched by a renderer update,
resulting in the image never being saved. The stall temporary renderer was then
blocking map updates. Only require the renderer update to be larger than the
calculated size, which will always happen since we trigger a full update.

In addition, remove wrong size heuristics for iso-hex tilesets: they behave
just like normal isometric tilesets.

Closes #1642.

(cherry picked from commit 5b04e82)
  • Loading branch information
lmoureaux committed Jan 18, 2023
1 parent bc431eb commit 5db3a22
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions client/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2795,10 +2795,7 @@ void mr_menu::save_image()
// The size of the image we want to render
QSize full_size((wld.map.xsize + 2) * tileset_tile_width(tileset),
(wld.map.ysize + 2) * tileset_tile_height(tileset));
if (tileset_hex_width(tileset) > 0) {
full_size.rheight() *= 11;
full_size.rheight() /= 20;
} else if (tileset_is_isometric(tileset)) {
if (tileset_is_isometric(tileset)) {
full_size.rheight() /= 2;
}

Expand All @@ -2810,7 +2807,7 @@ void mr_menu::save_image()
renderer, &freeciv::renderer::repaint_needed,
[=](const QRegion &where) {
// Maybe some other update sneaked in -- make sure to ignore it
if (where.boundingRect().size() == full_size) {
if (where.boundingRect().contains(QRect(QPoint(), full_size))) {
// File path
QString img_name =
QStringLiteral("Freeciv21-Turn%1").arg(game.info.turn);
Expand Down

0 comments on commit 5db3a22

Please sign in to comment.