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

Function ReadHeightMap

src/heightmap.cpp:481–495  ·  view source on GitHub ↗

* Reads the heightmap with the correct file reader. * @param dft Type of image file. * @param filename Name of the file to load. * @param[out] x Length of the image. * @param[out] y Height of the image. * @param[in,out] map If not \c nullptr, destination to store the loaded block of image data. * @return Whether loading was successful. */

Source from the content-addressed store, hash-verified

479 * @return Whether loading was successful.
480 */
481static bool ReadHeightMap(DetailedFileType dft, std::string_view filename, uint *x, uint *y, std::vector<uint8_t> *map)
482{
483 switch (dft) {
484 default:
485 NOT_REACHED();
486
487#ifdef WITH_PNG
488 case DFT_HEIGHTMAP_PNG:
489 return ReadHeightmapPNG(filename, x, y, map);
490#endif /* WITH_PNG */
491
492 case DFT_HEIGHTMAP_BMP:
493 return ReadHeightmapBMP(filename, x, y, map);
494 }
495}
496
497/**
498 * Get the dimensions of a heightmap.

Callers 2

GetHeightmapDimensionsFunction · 0.85
LoadHeightmapFunction · 0.85

Calls 3

NOT_REACHEDFunction · 0.85
ReadHeightmapPNGFunction · 0.85
ReadHeightmapBMPFunction · 0.85

Tested by

no test coverage detected