overlaying existing terrainFeatures now (#3706)

This commit is contained in:
GGGuenni 2021-03-17 20:58:48 +01:00 committed by GitHub
parent 5fa14b9533
commit cdc7739784
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 12 deletions

View File

@ -616,8 +616,8 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
if (terrainFeatureOverlayImage != null) terrainFeatureOverlayImage!!.remove()
terrainFeatureOverlayImage = null
if (terrainFeatures.isNotEmpty()) {
val terrainFeatureOverlayLocation = tileSetStrings.getTerrainFeatureOverlay(terrainFeatures)
for (terrainFeature in terrainFeatures) {
val terrainFeatureOverlayLocation = tileSetStrings.getTerrainFeatureOverlay(terrainFeature)
if (!ImageGetter.imageExists(terrainFeatureOverlayLocation)) return
terrainFeatureOverlayImage = ImageGetter.getImage(terrainFeatureOverlayLocation)
terrainFeatureLayerGroup.addActor(terrainFeatureOverlayImage)

View File

@ -51,16 +51,7 @@ class TileSetStrings {
val tag = "-"
fun getTile(baseTerrain: String) = getString(tilesLocation, baseTerrain)
fun getBaseTerrainOverlay(baseTerrain: String) = getString(tileSetLocation, baseTerrain, overlay)
fun getTerrainFeatureOverlay(terrainFeatures: Collection<String>): String {
val iterator = terrainFeatures.iterator()
val out = Array(terrainFeatures.size * 2 - 1){ //"+" gets added in front of each element except the first hence * 2 - 1
if (it % 2 == 0)
iterator.next()
else
"+"
}
return getString(tileSetLocation, *out, overlay)
}
fun getTerrainFeatureOverlay(terrainFeature: String) = getString(tileSetLocation, terrainFeature, overlay)
fun getCityTile(baseTerrain: String?, era: String?): String {
if (baseTerrain != null && era != null) return getString(tilesLocation, baseTerrain, city, tag, era)