|
OpenTTD Source 20251117-master-g7398d2e290
|
Functions related to creating heightmaps from files. More...
#include "fileio_type.h"Go to the source code of this file.
Enumerations | |
| enum | HeightmapRotation : uint8_t { HM_COUNTER_CLOCKWISE , HM_CLOCKWISE } |
| Order of these enums has to be the same as in lang/english.txt Otherwise you will get inconsistent behaviour. More... | |
Functions | |
| bool | GetHeightmapDimensions (DetailedFileType dft, std::string_view filename, uint *x, uint *y) |
| Get the dimensions of a heightmap. | |
| bool | LoadHeightmap (DetailedFileType dft, std::string_view filename) |
| Load a heightmap from file and change the map in its current dimensions to a landscape representing the heightmap. | |
| void | FlatEmptyWorld (uint8_t tile_height) |
| Make an empty world where all tiles are of height 'tile_height'. | |
| void | FixSlopes () |
| This function takes care of the fact that land in OpenTTD can never differ more than 1 in height. | |
Functions related to creating heightmaps from files.
Definition in file heightmap.h.
| enum HeightmapRotation : uint8_t |
Order of these enums has to be the same as in lang/english.txt Otherwise you will get inconsistent behaviour.
| Enumerator | |
|---|---|
| HM_COUNTER_CLOCKWISE | Rotate the map counter clockwise 45 degrees. |
| HM_CLOCKWISE | Rotate the map clockwise 45 degrees. |
Definition at line 19 of file heightmap.h.
| void FixSlopes | ( | ) |
This function takes care of the fact that land in OpenTTD can never differ more than 1 in height.
Definition at line 403 of file heightmap.cpp.
References _settings_game, CLEAR_ROCKS, GameSettings::construction, IsInnerTile(), MakeClear(), ConstructionSettings::map_height_limit, MAX_TILE_HEIGHT, RandomRange(), SetTileHeight(), Map::SizeX(), Map::SizeY(), TileHeight(), and TileXY().
Referenced by FlatEmptyWorld(), GenerateLandscape(), and LoadHeightmap().
| void FlatEmptyWorld | ( | uint8_t | tile_height | ) |
Make an empty world where all tiles are of height 'tile_height'.
| tile_height | of the desired new empty world |
Definition at line 542 of file heightmap.cpp.
References _settings_game, GameSettings::construction, FixSlopes(), ConstructionSettings::freeform_edges, MarkWholeScreenDirty(), SetTileHeight(), Map::SizeX(), Map::SizeY(), and TileXY().
Referenced by _GenerateWorld().
| bool GetHeightmapDimensions | ( | DetailedFileType | dft, |
| std::string_view | filename, | ||
| uint * | x, | ||
| uint * | y | ||
| ) |
Get the dimensions of a heightmap.
| dft | Type of image file. |
| filename | to query |
| x | dimension x |
| y | dimension y |
Definition at line 505 of file heightmap.cpp.
References ReadHeightMap().
| bool LoadHeightmap | ( | DetailedFileType | dft, |
| std::string_view | filename | ||
| ) |
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.
| dft | Type of image file. |
| filename | of the heightmap file to be imported |
Definition at line 517 of file heightmap.cpp.
References _settings_game, GameSettings::construction, FixSlopes(), ConstructionSettings::freeform_edges, GreyscaleToMapHeights(), IsMapSurroundedByWater(), MarkWholeScreenDirty(), and ReadHeightMap().
Referenced by GenerateLandscape().