mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-03 13:30:51 +07:00
Place edge images over terrains and under improvements, where possible to distinguish
This commit is contained in:
parent
2cfe78a197
commit
73516e15c9
@ -76,14 +76,19 @@ class TileLayerTerrain(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup,
|
|||||||
val terrainImages = if (tile.naturalWonder != null)
|
val terrainImages = if (tile.naturalWonder != null)
|
||||||
sequenceOf(tile.baseTerrain, tile.naturalWonder!!)
|
sequenceOf(tile.baseTerrain, tile.naturalWonder!!)
|
||||||
else sequenceOf(tile.baseTerrain) + tile.terrainFeatures.asSequence()
|
else sequenceOf(tile.baseTerrain) + tile.terrainFeatures.asSequence()
|
||||||
|
val edgeImages = getEdgeTileLocations()
|
||||||
val allTogether = (terrainImages + resourceAndImprovementSequence).joinToString("+")
|
val allTogether = (terrainImages + resourceAndImprovementSequence).joinToString("+")
|
||||||
val allTogetherLocation = strings().getTile(allTogether)
|
val allTogetherLocation = strings().getTile(allTogether)
|
||||||
|
|
||||||
|
// If the tilesetconfig *explicitly* lists the terrains+improvements etc, we can't know where in that list to place the edges
|
||||||
|
// So we default to placing them over everything else.
|
||||||
|
// If there is no explicit list, then we can know to place them between the terrain and the improvement
|
||||||
return when {
|
return when {
|
||||||
strings().tileSetConfig.ruleVariants[allTogether] != null -> baseHexagon + strings().tileSetConfig.ruleVariants[allTogether]!!.map { strings().getTile(it) }
|
strings().tileSetConfig.ruleVariants[allTogether] != null -> baseHexagon +
|
||||||
ImageGetter.imageExists(allTogetherLocation) -> baseHexagon + allTogetherLocation
|
strings().tileSetConfig.ruleVariants[allTogether]!!.map { strings().getTile(it) } + edgeImages
|
||||||
tile.naturalWonder != null -> getNaturalWonderBackupImage(baseHexagon)
|
ImageGetter.imageExists(allTogetherLocation) -> baseHexagon + allTogetherLocation + edgeImages
|
||||||
else -> baseHexagon + getTerrainImageLocations(terrainImages) + getImprovementAndResourceImages(resourceAndImprovementSequence)
|
tile.naturalWonder != null -> getNaturalWonderBackupImage(baseHexagon) + edgeImages
|
||||||
|
else -> baseHexagon + getTerrainImageLocations(terrainImages) + edgeImages + getImprovementAndResourceImages(resourceAndImprovementSequence)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,8 +114,7 @@ class TileLayerTerrain(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTileImage(viewingCiv: Civilization?) {
|
private fun updateTileImage(viewingCiv: Civilization?) {
|
||||||
val tileBaseImageLocations = getTileBaseImageLocations(viewingCiv) +
|
val tileBaseImageLocations = getTileBaseImageLocations(viewingCiv)
|
||||||
getEdgeTileLocations()
|
|
||||||
|
|
||||||
if (tileBaseImageLocations.size == tileImageIdentifiers.size) {
|
if (tileBaseImageLocations.size == tileImageIdentifiers.size) {
|
||||||
if (tileBaseImageLocations.withIndex().all { (i, imageLocation) -> tileImageIdentifiers[i] == imageLocation })
|
if (tileBaseImageLocations.withIndex().all { (i, imageLocation) -> tileImageIdentifiers[i] == imageLocation })
|
||||||
|
Loading…
Reference in New Issue
Block a user