* Load a heightmap from file and change the map in its current dimensions * to a landscape representing the heightmap. * It converts pixels to height. The brighter, the higher. * @param dft Type of image file. * @param filename of the heightmap file to be imported */
| 515 | * @param filename of the heightmap file to be imported |
| 516 | */ |
| 517 | bool LoadHeightmap(DetailedFileType dft, std::string_view filename) |
| 518 | { |
| 519 | uint x, y; |
| 520 | std::vector<uint8_t> map; |
| 521 | |
| 522 | if (!ReadHeightMap(dft, filename, &x, &y, &map)) { |
| 523 | return false; |
| 524 | } |
| 525 | |
| 526 | GreyscaleToMapHeights(x, y, map); |
| 527 | |
| 528 | FixSlopes(); |
| 529 | |
| 530 | /* If all map borders are water, we will draw infinite water. */ |
| 531 | _settings_game.construction.freeform_edges = !IsMapSurroundedByWater(); |
| 532 | |
| 533 | MarkWholeScreenDirty(); |
| 534 | |
| 535 | return true; |
| 536 | } |
| 537 | |
| 538 | /** |
| 539 | * Make an empty world where all tiles are of height 'tile_height'. |
no test coverage detected