mirror of
https://github.com/yairm210/Unciv.git
synced 2024-12-22 23:24:25 +07:00
Actual performance change :)
This commit is contained in:
parent
1c17a20018
commit
8e0115263b
@ -109,8 +109,7 @@ class TileLayerTerrain(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup,
|
||||
}
|
||||
|
||||
private fun updateTileImage(viewingCiv: Civilization?) {
|
||||
val tileBaseImageLocations = getTileBaseImageLocations(viewingCiv) +
|
||||
getEdgeTileLocations()
|
||||
val tileBaseImageLocations = getTileBaseImageLocations(viewingCiv)
|
||||
|
||||
if (tileBaseImageLocations.size == tileImageIdentifiers.size) {
|
||||
if (tileBaseImageLocations.withIndex().all { (i, imageLocation) -> tileImageIdentifiers[i] == imageLocation })
|
||||
@ -118,9 +117,11 @@ class TileLayerTerrain(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup,
|
||||
}
|
||||
tileImageIdentifiers = tileBaseImageLocations
|
||||
|
||||
val allImages = tileBaseImageLocations + getEdgeTileLocations()
|
||||
|
||||
for (image in tileBaseImages) image.remove()
|
||||
tileBaseImages.clear()
|
||||
for (baseLocation in tileBaseImageLocations) {
|
||||
for (baseLocation in allImages) {
|
||||
// Here we check what actual tiles exist, and pick one - not at random, but based on the tile location,
|
||||
// so it stays consistent throughout the game
|
||||
if (!ImageGetter.imageExists(baseLocation)) continue
|
||||
|
Loading…
Reference in New Issue
Block a user