MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / MakeScreenshotWithConfirm

Function MakeScreenshotWithConfirm

src/screenshot.cpp:353–371  ·  view source on GitHub ↗

* Make a screenshot. * Ask for confirmation first if the screenshot will be huge. * @param t Screenshot type: World, defaultzoom, heightmap or viewport screenshot * @see MakeScreenshot */

Source from the content-addressed store, hash-verified

351 * @see MakeScreenshot
352 */
353void MakeScreenshotWithConfirm(ScreenshotType t)
354{
355 Viewport vp = SetupScreenshotViewport(t);
356
357 bool heightmap_or_minimap = t == SC_HEIGHTMAP || t == SC_MINIMAP;
358 uint64_t width = (heightmap_or_minimap ? Map::SizeX() : vp.width);
359 uint64_t height = (heightmap_or_minimap ? Map::SizeY() : vp.height);
360
361 if (width * height > 8192 * 8192) {
362 /* Ask for confirmation */
363 _confirmed_screenshot_type = t;
364 ShowQuery(
365 GetEncodedString(STR_WARNING_SCREENSHOT_SIZE_CAPTION),
366 GetEncodedString(STR_WARNING_SCREENSHOT_SIZE_MESSAGE, width, height), nullptr, ScreenshotConfirmationCallback);
367 } else {
368 /* Less than 64M pixels, just do it */
369 MakeScreenshot(t, {});
370 }
371}
372
373/**
374 * Make a screenshot.

Callers 3

OnHotkeyMethod · 0.85
OnHotkeyMethod · 0.85
OnClickMethod · 0.85

Calls 4

SetupScreenshotViewportFunction · 0.85
ShowQueryFunction · 0.85
MakeScreenshotFunction · 0.85
GetEncodedStringFunction · 0.70

Tested by

no test coverage detected