summaryrefslogtreecommitdiff
path: root/src/screenshot.cpp
diff options
context:
space:
mode:
authorAbdurrahmaan Iqbal <abdurrahmaaniqbal@hotmail.com>2020-06-23 15:20:02 +0100
committerCharles Pigott <charlespigott@googlemail.com>2020-06-27 14:19:35 +0100
commit8a655c7fb6375ad47b951b5011657dfa31cc76a6 (patch)
tree88380b1d962420b617b1a2e2b8850c1e08158fc0 /src/screenshot.cpp
parent3c8d0aa3544602dd8e34ec8ffcdc12cfc7f73b3f (diff)
downloadopenttd-8a655c7fb6375ad47b951b5011657dfa31cc76a6.tar.xz
Fix #8232: 'Huge screenshot' warning being shown incorrectly
Diffstat (limited to 'src/screenshot.cpp')
-rw-r--r--src/screenshot.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index c89586226..8cf83ae5b 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -854,11 +854,16 @@ void MakeScreenshotWithConfirm(ScreenshotType t)
{
ViewPort vp;
SetupScreenshotViewport(t, &vp);
- if ((uint64)vp.width * (uint64)vp.height > 8192 * 8192) {
+
+ bool heightmap_or_minimap = t == SC_HEIGHTMAP || t == SC_MINIMAP;
+ uint64_t width = (heightmap_or_minimap ? MapSizeX() : vp.width);
+ uint64_t height = (heightmap_or_minimap ? MapSizeY() : vp.height);
+
+ if (width * height > 8192 * 8192) {
/* Ask for confirmation */
_confirmed_screenshot_type = t;
- SetDParam(0, vp.width);
- SetDParam(1, vp.height);
+ SetDParam(0, width);
+ SetDParam(1, height);
ShowQuery(STR_WARNING_SCREENSHOT_SIZE_CAPTION, STR_WARNING_SCREENSHOT_SIZE_MESSAGE, nullptr, ScreenshotConfirmationCallback);
} else {
/* Less than 64M pixels, just do it */