summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/heightmap.cpp2
-rw-r--r--src/heightmap.h6
-rw-r--r--src/landscape.cpp10
3 files changed, 13 insertions, 5 deletions
diff --git a/src/heightmap.cpp b/src/heightmap.cpp
index 36e962dde..04207cd2e 100644
--- a/src/heightmap.cpp
+++ b/src/heightmap.cpp
@@ -352,7 +352,7 @@ static void GrayscaleToMapHeights(uint img_width, uint img_height, byte *map)
* This function takes care of the fact that land in OpenTTD can never differ
* more than 1 in height
*/
-static void FixSlopes()
+void FixSlopes()
{
uint width, height;
int row, col;
diff --git a/src/heightmap.h b/src/heightmap.h
index 1bbe197d9..c30ef0d9a 100644
--- a/src/heightmap.h
+++ b/src/heightmap.h
@@ -37,4 +37,10 @@ void LoadHeightmap(char *filename);
*/
void FlatEmptyWorld(byte tile_height);
+/**
+ * This function takes care of the fact that land in OpenTTD can never differ
+ * more than 1 in height
+ */
+void FixSlopes();
+
#endif /* HEIGHTMAP_H */
diff --git a/src/landscape.cpp b/src/landscape.cpp
index 15d70bbfd..f3b8ccd6f 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -766,7 +766,7 @@ static void GenerateTerrain(int type, uint flag)
Tile *tile_cur = tile;
for (uint w_cur = w; w_cur != 0; --w_cur) {
- if (*p >= tile_cur->type_height) tile_cur->type_height = *p;
+ if (GB(*p, 0, 4) >= tile_cur->type_height) tile_cur->type_height = GB(*p, 0, 4);
p++;
tile_cur++;
}
@@ -779,7 +779,7 @@ static void GenerateTerrain(int type, uint flag)
Tile *tile_cur = tile;
for (uint h_cur = h; h_cur != 0; --h_cur) {
- if (*p >= tile_cur->type_height) tile_cur->type_height = *p;
+ if (GB(*p, 0, 4) >= tile_cur->type_height) tile_cur->type_height = GB(*p, 0, 4);
p++;
tile_cur += TileDiffXY(0, 1);
}
@@ -793,7 +793,7 @@ static void GenerateTerrain(int type, uint flag)
Tile *tile_cur = tile;
for (uint w_cur = w; w_cur != 0; --w_cur) {
- if (*p >= tile_cur->type_height) tile_cur->type_height = *p;
+ if (GB(*p, 0, 4) >= tile_cur->type_height) tile_cur->type_height = GB(*p, 0, 4);
p++;
tile_cur--;
}
@@ -807,7 +807,7 @@ static void GenerateTerrain(int type, uint flag)
Tile *tile_cur = tile;
for (uint h_cur = h; h_cur != 0; --h_cur) {
- if (*p >= tile_cur->type_height) tile_cur->type_height = *p;
+ if (GB(*p, 0, 4) >= tile_cur->type_height) tile_cur->type_height = GB(*p, 0, 4);
p++;
tile_cur -= TileDiffXY(0, 1);
}
@@ -815,6 +815,8 @@ static void GenerateTerrain(int type, uint flag)
} while (--w != 0);
break;
}
+
+ FixSlopes();
}