OpenTTD Source  20241120-master-g6d3adc6169
heightmap.h File Reference

Functions related to creating heightmaps from files. More...

#include "fileio_type.h"

Go to the source code of this file.

Enumerations

enum  HeightmapRotation { 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, const char *filename, uint *x, uint *y)
 Get the dimensions of a heightmap. More...
 
bool LoadHeightmap (DetailedFileType dft, const char *filename)
 Load a heightmap from file and change the map in its current dimensions to a landscape representing the heightmap. More...
 
void FlatEmptyWorld (uint8_t tile_height)
 Make an empty world where all tiles are of height 'tile_height'. More...
 
void FixSlopes ()
 This function takes care of the fact that land in OpenTTD can never differ more than 1 in height.
 

Detailed Description

Functions related to creating heightmaps from files.

Definition in file heightmap.h.

Enumeration Type Documentation

◆ HeightmapRotation

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.

Function Documentation

◆ FlatEmptyWorld()

void FlatEmptyWorld ( uint8_t  tile_height)

Make an empty world where all tiles are of height 'tile_height'.

Parameters
tile_heightof the desired new empty world

Definition at line 521 of file heightmap.cpp.

References _settings_game, GameSettings::construction, FixSlopes(), ConstructionSettings::freeform_edges, MarkWholeScreenDirty(), SetTileHeight(), Map::SizeX(), Map::SizeY(), and TileXY().

◆ GetHeightmapDimensions()

bool GetHeightmapDimensions ( DetailedFileType  dft,
const char *  filename,
uint *  x,
uint *  y 
)

Get the dimensions of a heightmap.

Parameters
dftType of image file.
filenameto query
xdimension x
ydimension y
Returns
Returns false if loading of the image failed.

Definition at line 488 of file heightmap.cpp.

◆ LoadHeightmap()

bool LoadHeightmap ( DetailedFileType  dft,
const char *  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.

Parameters
dftType of image file.
filenameof the heightmap file to be imported

Definition at line 500 of file heightmap.cpp.