* 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. */
| 479 | * @return Whether loading was successful. |
| 480 | */ |
| 481 | static 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. |
no test coverage detected