Hills are converted to terrains that surround them

This commit is contained in:
Yair Morgenstern 2021-05-05 18:00:07 +03:00
parent b35d5d3121
commit fb93e3f7ee
3 changed files with 619 additions and 603 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 877 KiB

After

Width:  |  Height:  |  Size: 888 KiB

View File

@ -661,8 +661,10 @@ open class TileInfo {
private fun convertHillToTerrainFeature(){
if (baseTerrain == Constants.hill &&
ruleset.terrains[Constants.hill]?.type == TerrainType.TerrainFeature){
baseTerrain = Constants.grassland
ruleset.terrains[Constants.hill]?.type == TerrainType.TerrainFeature) {
val mostCommonBaseTerrain = neighbors.filter { it.isLand && !it.isImpassible() }
.groupBy { it.baseTerrain }.maxByOrNull { it.value.size }
baseTerrain = mostCommonBaseTerrain?.key ?: Constants.grassland
//We have to add hill as first terrain feature
val copy = terrainFeatures.toTypedArray()
terrainFeatures.clear()