mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-05 21:11:35 +07:00
More memory perf improvements
This commit is contained in:
parent
98c49ecea3
commit
eb180523d6
@ -826,8 +826,10 @@ class Tile : IsPartOfGameInfoSerialization, Json.Serializable {
|
||||
setTerrainFeatures(ArrayList(terrainFeatures).apply { add(terrainFeature) })
|
||||
}
|
||||
|
||||
fun removeTerrainFeature(terrainFeature: String) =
|
||||
setTerrainFeatures(ArrayList(terrainFeatures).apply { remove(terrainFeature) })
|
||||
fun removeTerrainFeature(terrainFeature: String) {
|
||||
if (terrainFeature in terrainFeatures)
|
||||
setTerrainFeatures(ArrayList(terrainFeatures).apply { remove(terrainFeature) })
|
||||
}
|
||||
|
||||
fun removeTerrainFeatures() =
|
||||
setTerrainFeatures(listOf())
|
||||
|
@ -3,11 +3,12 @@ package com.unciv.ui.components.input
|
||||
import com.unciv.models.UncivSound
|
||||
import com.unciv.ui.audio.SoundPlayer
|
||||
import com.unciv.utils.Concurrency
|
||||
import java.util.EnumMap
|
||||
|
||||
typealias ActivationAction = () -> Unit
|
||||
|
||||
// The delegation inheritance is only done to reduce the signature and limit clients to *our* add functions
|
||||
internal class ActivationActionMap : MutableMap<ActivationTypes, ActivationActionMap.ActivationActionList> by LinkedHashMap() {
|
||||
internal class ActivationActionMap : MutableMap<ActivationTypes, ActivationActionMap.ActivationActionList> by EnumMap(ActivationTypes::class.java) {
|
||||
// todo Old listener said "happens if there's a double (or more) click function but no single click" -
|
||||
// means when we register a single-click but the listener *only* reports a double, the registered single-click action is invoked.
|
||||
|
||||
|
@ -102,14 +102,16 @@ class TileGroupMap<T: TileGroup>(
|
||||
drawTopX = topX - bottomX
|
||||
drawBottomX = bottomX - bottomX
|
||||
|
||||
val baseLayers = ArrayList<TileLayerTerrain>()
|
||||
val featureLayers = ArrayList<TileLayerFeatures>()
|
||||
val borderLayers = ArrayList<TileLayerBorders>()
|
||||
val miscLayers = ArrayList<TileLayerMisc>()
|
||||
val pixelUnitLayers = ArrayList<TileLayerUnitSprite>()
|
||||
val circleFogCrosshairLayers = ArrayList<TileLayerOverlay>()
|
||||
val unitLayers = ArrayList<TileLayerUnitFlag>()
|
||||
val cityButtonLayers = ArrayList<TileLayerCityButton>()
|
||||
val numberOfTilegroups = tileGroups.count()
|
||||
|
||||
val baseLayers = ArrayList<TileLayerTerrain>(numberOfTilegroups)
|
||||
val featureLayers = ArrayList<TileLayerFeatures>(numberOfTilegroups)
|
||||
val borderLayers = ArrayList<TileLayerBorders>(numberOfTilegroups)
|
||||
val miscLayers = ArrayList<TileLayerMisc>(numberOfTilegroups)
|
||||
val pixelUnitLayers = ArrayList<TileLayerUnitSprite>(numberOfTilegroups)
|
||||
val circleFogCrosshairLayers = ArrayList<TileLayerOverlay>(numberOfTilegroups)
|
||||
val unitLayers = ArrayList<TileLayerUnitFlag>(numberOfTilegroups)
|
||||
val cityButtonLayers = ArrayList<TileLayerCityButton>(numberOfTilegroups)
|
||||
|
||||
// Apparently the sortedByDescending is kinda memory-intensive because it needs to sort ALL the tiles
|
||||
// So instead we group by and then sort on the groups
|
||||
|
Loading…
Reference in New Issue
Block a user