mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #853 from ThomasdenH/develop
Fixed map smoothing issue
This commit is contained in:
commit
4f61c6078e
|
@ -56,11 +56,46 @@ int map_smooth(int l, int t, int r, int b)
|
|||
|
||||
if (highest >= mapElement->base_height + 4) {
|
||||
count = 0;
|
||||
int canCompensate = 1;
|
||||
for (i = 0; i < 4; i++)
|
||||
if (cornerHeights[i] == highest)
|
||||
if (cornerHeights[i] == highest){
|
||||
count++;
|
||||
|
||||
if (count == 1) {
|
||||
// Check if surrounding corners aren't too high. The current tile
|
||||
// can't compensate for all the height differences anymore if it has
|
||||
// the extra height slope.
|
||||
int highestOnLowestSide;
|
||||
switch (i){
|
||||
case 0:
|
||||
highestOnLowestSide = max(
|
||||
map_get_surface_element_at(x + 1, y)->base_height,
|
||||
map_get_surface_element_at(x, y + 1)->base_height);
|
||||
break;
|
||||
case 1:
|
||||
highestOnLowestSide = max(
|
||||
map_get_surface_element_at(x - 1, y)->base_height,
|
||||
map_get_surface_element_at(x, y + 1)->base_height);
|
||||
break;
|
||||
case 2:
|
||||
highestOnLowestSide = max(
|
||||
map_get_surface_element_at(x - 1, y)->base_height,
|
||||
map_get_surface_element_at(x, y - 1)->base_height);
|
||||
break;
|
||||
case 3:
|
||||
highestOnLowestSide = max(
|
||||
map_get_surface_element_at(x + 1, y)->base_height,
|
||||
map_get_surface_element_at(x, y - 1)->base_height);
|
||||
break;
|
||||
}
|
||||
|
||||
if (highestOnLowestSide > mapElement->base_height){
|
||||
mapElement->base_height = mapElement->clearance_height = highestOnLowestSide;
|
||||
raisedLand = 1;
|
||||
canCompensate = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 1 && canCompensate) {
|
||||
if (mapElement->base_height < highest - 4) {
|
||||
mapElement->base_height = mapElement->clearance_height = highest - 4;
|
||||
raisedLand = 1;
|
||||
|
|
|
@ -190,7 +190,7 @@ void mapgen_generate(mapgen_settings *settings)
|
|||
mapgen_set_height();
|
||||
free(_height);
|
||||
|
||||
// Set the tile slopes so that their are no cliffs
|
||||
// Set the tile slopes so that there are no cliffs
|
||||
while (map_smooth(1, 1, mapSize - 1, mapSize - 1)) { }
|
||||
|
||||
// Add the water
|
||||
|
|
Loading…
Reference in New Issue