Ability to place the resources over the terrain features (#2270)
* Ability to place the resources over the terrain features * Fossils can be found under the forest * Revert previous commit "Fossils can be found under the forest" This reverts commit 4e1fcd8c45ffd08090ce4b808d228636bfccfc6b. * Ignore the vegetation and spawn the resource right under it
This commit is contained in:
parent
f79d01162b
commit
0290051aa0
1 changed files with 6 additions and 4 deletions
|
@ -372,12 +372,14 @@ class MapGenerator(val ruleset: Ruleset) {
|
|||
// Here, we need each specific resource to be spread over the map - it matters less if specific resources are near each other
|
||||
private fun spreadStrategicResources(tileMap: TileMap, distance: Int) {
|
||||
val strategicResources = ruleset.tileResources.values.filter { it.resourceType == ResourceType.Strategic }
|
||||
val totalNumberOfResources = tileMap.values.count { it.isLand && !it.getBaseTerrain().impassable } *
|
||||
tileMap.mapParameters.resourceRichness
|
||||
// passable land tiles (no mountains, no wonders) without resources yet
|
||||
val candidateTiles = tileMap.values.filter { it.resource == null && it.isLand && !it.getLastTerrain().impassable }
|
||||
val totalNumberOfResources = candidateTiles.size * tileMap.mapParameters.resourceRichness
|
||||
val resourcesPerType = (totalNumberOfResources/strategicResources.size).toInt()
|
||||
for (resource in strategicResources) {
|
||||
val suitableTiles = tileMap.values
|
||||
.filter { it.resource == null && resource.terrainsCanBeFoundOn.contains(it.getLastTerrain().name) }
|
||||
// remove the tiles where previous resources have been placed
|
||||
val suitableTiles = candidateTiles
|
||||
.filter { it.resource == null && resource.terrainsCanBeFoundOn.contains(it.getBaseTerrain().name)}
|
||||
|
||||
val locations = chooseSpreadOutLocations(resourcesPerType, suitableTiles, distance)
|
||||
|
||||
|
|
Loading…
Reference in a new issue