Feature: auto-detect map height limit based on generated map
This opens up the true power of the TGP terrain generator, as it is no longer constrainted by an arbitrary low map height limit, especially for extreme terrain types. In other words: on a 1kx1k map with "Alpinist" terrain type, the map is now really hilly with default settings. People can still manually limit the map height if they so wish, and after the terrain generation the limit is stored in the savegame as if the user set it. Cheats still allow you to change this value.
This commit is contained in:

committed by
Patric Stout

parent
1a1049bc0d
commit
422e132845
15
src/tgp.cpp
15
src/tgp.cpp
@@ -237,7 +237,20 @@ static height_t TGPGetMaxHeight()
|
||||
int map_size_bucket = std::min(MapLogX(), MapLogY()) - MIN_MAP_SIZE_BITS;
|
||||
int max_height_from_table = max_height[_settings_game.difficulty.terrain_type][map_size_bucket];
|
||||
|
||||
return I2H(std::min<uint>(max_height_from_table, _settings_game.construction.map_height_limit));
|
||||
/* If there is a manual map height limit, clamp to it. */
|
||||
if (_settings_game.construction.map_height_limit != 0) {
|
||||
max_height_from_table = std::min<uint>(max_height_from_table, _settings_game.construction.map_height_limit);
|
||||
}
|
||||
|
||||
return I2H(max_height_from_table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an overestimation of the highest peak TGP wants to generate.
|
||||
*/
|
||||
uint GetEstimationTGPMapHeight()
|
||||
{
|
||||
return H2I(TGPGetMaxHeight());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user