Improve lake generation
Prior to this change, lakes could be very small and could also not be deactivated. This change allows the deactivation of lake creation and the lake size is now the set size +- 25% instead of anything between 0 and lake_size.
This commit is contained in:
@@ -1333,7 +1333,7 @@ static bool FlowRiver(TileIndex spring, TileIndex begin, uint min_river_length)
|
|||||||
if (found) {
|
if (found) {
|
||||||
/* Flow further down hill. */
|
/* Flow further down hill. */
|
||||||
found = FlowRiver(spring, end, min_river_length);
|
found = FlowRiver(spring, end, min_river_length);
|
||||||
} else if (count > 32) {
|
} else if (count > 32 && _settings_game.game_creation.lake_size != 0) {
|
||||||
/* Maybe we can make a lake. Find the Nth of the considered tiles. */
|
/* Maybe we can make a lake. Find the Nth of the considered tiles. */
|
||||||
TileIndex lakeCenter = 0;
|
TileIndex lakeCenter = 0;
|
||||||
int i = RandomRange(count - 1) + 1;
|
int i = RandomRange(count - 1) + 1;
|
||||||
@@ -1358,7 +1358,10 @@ static bool FlowRiver(TileIndex spring, TileIndex begin, uint min_river_length)
|
|||||||
/* Remove desert directly around the river tile. */
|
/* Remove desert directly around the river tile. */
|
||||||
CircularTileSearch(&lakeCenter, _settings_game.game_creation.river_tropics_width, RiverModifyDesertZone, nullptr);
|
CircularTileSearch(&lakeCenter, _settings_game.game_creation.river_tropics_width, RiverModifyDesertZone, nullptr);
|
||||||
lakeCenter = end;
|
lakeCenter = end;
|
||||||
uint range = RandomRange(_settings_game.game_creation.lake_size) + 3;
|
|
||||||
|
// Setting lake size +- 25%
|
||||||
|
const auto random_percentage = 75 + RandomRange(50);
|
||||||
|
const uint range = ((_settings_game.game_creation.lake_size * random_percentage) / 100) + 3;
|
||||||
|
|
||||||
MakeLakeData data;
|
MakeLakeData data;
|
||||||
data.centre = lakeCenter;
|
data.centre = lakeCenter;
|
||||||
@@ -1401,7 +1404,7 @@ static void CreateRivers()
|
|||||||
|
|
||||||
for (; wells > num_short_rivers; wells--) {
|
for (; wells > num_short_rivers; wells--) {
|
||||||
IncreaseGeneratingWorldProgress(GWP_RIVER);
|
IncreaseGeneratingWorldProgress(GWP_RIVER);
|
||||||
for (int tries = 0; tries < 512; tries++) {
|
for (int tries = 0; tries < 128; tries++) {
|
||||||
TileIndex t = RandomTile();
|
TileIndex t = RandomTile();
|
||||||
if (!CircularTileSearch(&t, 8, FindSpring, nullptr)) continue;
|
if (!CircularTileSearch(&t, 8, FindSpring, nullptr)) continue;
|
||||||
_current_spring = t;
|
_current_spring = t;
|
||||||
|
@@ -1502,6 +1502,8 @@ STR_CONFIG_SETTING_RIVER_TROPICS_WIDTH :Tropics width a
|
|||||||
STR_CONFIG_SETTING_RIVER_TROPICS_WIDTH_HELPTEXT :Controls the width of the tropic zone that surrounds rivers in sub-tropic landscape.
|
STR_CONFIG_SETTING_RIVER_TROPICS_WIDTH_HELPTEXT :Controls the width of the tropic zone that surrounds rivers in sub-tropic landscape.
|
||||||
STR_CONFIG_SETTING_LAKE_SIZE :Size of lakes: {STRING}
|
STR_CONFIG_SETTING_LAKE_SIZE :Size of lakes: {STRING}
|
||||||
STR_CONFIG_SETTING_LAKE_SIZE_HELPTEXT :Controls the size of lakes that are generated along rivers.
|
STR_CONFIG_SETTING_LAKE_SIZE_HELPTEXT :Controls the size of lakes that are generated along rivers.
|
||||||
|
STR_CONFIG_SETTING_LAKE_SIZE_VALUE :{NUM}
|
||||||
|
STR_CONFIG_SETTING_LAKE_SIZE_ZERO :No lakes
|
||||||
STR_CONFIG_SETTING_LAKES_ALLOWED_IN_DESERTS :Lakes can be generated in sub-tropic climate deserts: {STRING}
|
STR_CONFIG_SETTING_LAKES_ALLOWED_IN_DESERTS :Lakes can be generated in sub-tropic climate deserts: {STRING}
|
||||||
STR_CONFIG_SETTING_LAKES_ALLOWED_IN_DESERTS_HELPTEXT :Choose whether the lakes that spawn along rivers are allowed in deserts.
|
STR_CONFIG_SETTING_LAKES_ALLOWED_IN_DESERTS_HELPTEXT :Choose whether the lakes that spawn along rivers are allowed in deserts.
|
||||||
STR_CONFIG_SETTING_RIVER_AMOUNT :River amount: {STRING2}
|
STR_CONFIG_SETTING_RIVER_AMOUNT :River amount: {STRING2}
|
||||||
|
@@ -4000,14 +4000,14 @@ patxname = ""rivers.game_creation.river_tropics_width""
|
|||||||
base = GameSettings
|
base = GameSettings
|
||||||
var = game_creation.lake_size
|
var = game_creation.lake_size
|
||||||
type = SLE_UINT8
|
type = SLE_UINT8
|
||||||
guiflags = SGF_NEWGAME_ONLY | SGF_SCENEDIT_TOO
|
guiflags = SGF_NEWGAME_ONLY | SGF_SCENEDIT_TOO | SGF_0ISDISABLED
|
||||||
def = 8
|
def = 8
|
||||||
min = 1
|
min = 0
|
||||||
max = 100
|
max = 255
|
||||||
cat = SC_EXPERT
|
cat = SC_EXPERT
|
||||||
str = STR_CONFIG_SETTING_LAKE_SIZE
|
str = STR_CONFIG_SETTING_LAKE_SIZE
|
||||||
strhelp = STR_CONFIG_SETTING_LAKE_SIZE_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_LAKE_SIZE_HELPTEXT
|
||||||
strval = STR_JUST_COMMA
|
strval = STR_CONFIG_SETTING_LAKE_SIZE_VALUE
|
||||||
patxname = ""rivers.game_creation.lake_size""
|
patxname = ""rivers.game_creation.lake_size""
|
||||||
|
|
||||||
[SDT_BOOL]
|
[SDT_BOOL]
|
||||||
|
Reference in New Issue
Block a user