mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 03:23:17 -04:00
Resolved #8529 - fixed 5hex image issues
This commit is contained in:
parent
d43e190d24
commit
a84470c74e
@ -5,14 +5,14 @@ class TileSet(val name: String) {
|
|||||||
var config = TileSetConfig()
|
var config = TileSetConfig()
|
||||||
var fallback: TileSet? = null
|
var fallback: TileSet? = null
|
||||||
|
|
||||||
private val configs = HashMap<String, TileSetConfig>()
|
private val modNameToConfig = HashMap<String, TileSetConfig>()
|
||||||
|
|
||||||
fun addConfig(id: String, config: TileSetConfig) {
|
fun cacheConfigFromMod(modName: String, config: TileSetConfig) {
|
||||||
configs[id] = config
|
modNameToConfig[modName] = config
|
||||||
}
|
}
|
||||||
|
|
||||||
fun mergeConfig(id: String) {
|
fun mergeModConfig(modName: String) {
|
||||||
val configToMerge = configs[id] ?: return
|
val configToMerge = modNameToConfig[modName] ?: return
|
||||||
config.updateConfig(configToMerge)
|
config.updateConfig(configToMerge)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,4 +24,6 @@ class TileSet(val name: String) {
|
|||||||
const val DEFAULT = "INTERNAL"
|
const val DEFAULT = "INTERNAL"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String = name
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import com.unciv.json.fromJsonFile
|
|||||||
import com.unciv.json.json
|
import com.unciv.json.json
|
||||||
import com.unciv.models.ruleset.RulesetCache
|
import com.unciv.models.ruleset.RulesetCache
|
||||||
import com.unciv.ui.images.ImageGetter
|
import com.unciv.ui.images.ImageGetter
|
||||||
import com.unciv.utils.debug
|
|
||||||
|
|
||||||
object TileSetCache : HashMap<String, TileSet>() {
|
object TileSetCache : HashMap<String, TileSet>() {
|
||||||
|
|
||||||
@ -33,7 +32,9 @@ object TileSetCache : HashMap<String, TileSet>() {
|
|||||||
values.forEach { it.resetConfig() }
|
values.forEach { it.resetConfig() }
|
||||||
|
|
||||||
for (mod in mods.distinct()) {
|
for (mod in mods.distinct()) {
|
||||||
values.forEach { it.mergeConfig(mod) }
|
for (tileset in values) {
|
||||||
|
tileset.mergeModConfig(mod)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ object TileSetCache : HashMap<String, TileSet>() {
|
|||||||
val name = configFile.nameWithoutExtension().removeSuffix("Config")
|
val name = configFile.nameWithoutExtension().removeSuffix("Config")
|
||||||
val config = json().fromJsonFile(TileSetConfig::class.java, configFile)
|
val config = json().fromJsonFile(TileSetConfig::class.java, configFile)
|
||||||
val tileset = get(name) ?: TileSet(name)
|
val tileset = get(name) ?: TileSet(name)
|
||||||
tileset.addConfig(configId, config)
|
tileset.cacheConfigFromMod(configId, config)
|
||||||
set(name, tileset)
|
set(name, tileset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ class TileSetConfig {
|
|||||||
unexploredTileColor = other.unexploredTileColor
|
unexploredTileColor = other.unexploredTileColor
|
||||||
fogOfWarColor = other.fogOfWarColor
|
fogOfWarColor = other.fogOfWarColor
|
||||||
fallbackTileSet = other.fallbackTileSet
|
fallbackTileSet = other.fallbackTileSet
|
||||||
|
tileScale = other.tileScale
|
||||||
for ((tileString, scale) in other.tileScales){
|
for ((tileString, scale) in other.tileScales){
|
||||||
tileScales[tileString] = scale
|
tileScales[tileString] = scale
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user