* Make a heightmap of the current map. * @param filename Filename to use for saving. */
| 312 | * @param filename Filename to use for saving. |
| 313 | */ |
| 314 | bool 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 | |
| 336 | static ScreenshotType _confirmed_screenshot_type; ///< Screenshot type the current query is about to confirm. |
| 337 |
no test coverage detected