|
@@ -428,49 +428,49 @@ void FixSlopes()
|
|
|
current_tile = TileHeight(TileXY(col + 1, row)); // bottom edge
|
|
|
}
|
|
|
|
|
|
if ((uint)row != height - 1) {
|
|
|
if (TileHeight(TileXY(col, row + 1)) < current_tile) {
|
|
|
current_tile = TileHeight(TileXY(col, row + 1)); // right edge
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* Does the height differ more than one? */
|
|
|
if (TileHeight(TileXY(col, row)) >= (uint)current_tile + 2) {
|
|
|
/* Then change the height to be no more than one */
|
|
|
SetTileHeight(TileXY(col, row), current_tile + 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 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 [inout] map If not \c NULL, destination to store the loaded block of image data.
|
|
|
* @param[in,out] map If not \c NULL, destination to store the loaded block of image data.
|
|
|
* @return Whether loading was successful.
|
|
|
*/
|
|
|
static bool ReadHeightMap(DetailedFileType dft, const char *filename, uint *x, uint *y, byte **map)
|
|
|
{
|
|
|
switch (dft) {
|
|
|
default:
|
|
|
NOT_REACHED();
|
|
|
|
|
|
#ifdef WITH_PNG
|
|
|
case DFT_HEIGHTMAP_PNG:
|
|
|
return ReadHeightmapPNG(filename, x, y, map);
|
|
|
#endif /* WITH_PNG */
|
|
|
|
|
|
case DFT_HEIGHTMAP_BMP:
|
|
|
return ReadHeightmapBMP(filename, x, y, map);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Get the dimensions of a heightmap.
|
|
|
* @param dft Type of image file.
|
|
|
* @param filename to query
|
|
|
* @param x dimension x
|
|
|
* @param y dimension y
|