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

Function MakeHeightmapScreenshot

src/screenshot.cpp:314–334  ·  view source on GitHub ↗

* Make a heightmap of the current map. * @param filename Filename to use for saving. */

Source from the content-addressed store, hash-verified

312 * @param filename Filename to use for saving.
313 */
314bool MakeHeightmapScreenshot(std::string_view filename)
315{
316 auto provider = GetScreenshotProvider();
317 if (provider == nullptr) return false;
318
319 Colour palette[256];
320 for (uint i = 0; i < lengthof(palette); i++) {
321 palette[i].a = 0xff;
322 palette[i].r = i;
323 palette[i].g = i;
324 palette[i].b = i;
325 }
326
327 _heightmap_highest_peak = 0;
328 for (const auto tile : Map::Iterate()) {
329 uint h = TileHeight(tile);
330 _heightmap_highest_peak = std::max(h, _heightmap_highest_peak);
331 }
332
333 return provider->MakeImage(filename, HeightmapCallback, Map::SizeX(), Map::SizeY(), 8, palette);
334}
335
336static ScreenshotType _confirmed_screenshot_type; ///< Screenshot type the current query is about to confirm.
337

Callers 2

SwitchToModeFunction · 0.85
RealMakeScreenshotFunction · 0.85

Calls 3

GetScreenshotProviderFunction · 0.85
TileHeightFunction · 0.85
MakeImageMethod · 0.45

Tested by

no test coverage detected