mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-21 20:18:28 +07:00
Resolved #10478 - *internal* tilesets to load are now determined pre-loading, to minimize concurrent modification exceptions
This commit is contained in:
parent
dfcedb6267
commit
e8b9864287
@ -49,13 +49,14 @@ object TileSetCache : HashMap<String, TileSet>() {
|
||||
clear()
|
||||
|
||||
// Load internal TileSets
|
||||
val internalFiles: Sequence<FileHandle> =
|
||||
val internalFiles: List<FileHandle> =
|
||||
if (consoleMode)
|
||||
FileHandle("jsons/TileSets").list().asSequence()
|
||||
FileHandle("jsons/TileSets").list().toList()
|
||||
else
|
||||
ImageGetter.getAvailableTilesets()
|
||||
.map { Gdx.files.internal("jsons/TileSets/$it.json") }
|
||||
.filter { it.exists() }
|
||||
.toList()
|
||||
|
||||
loadConfigFiles(internalFiles, TileSet.DEFAULT)
|
||||
|
||||
@ -68,7 +69,7 @@ object TileSetCache : HashMap<String, TileSet>() {
|
||||
val modName = modFolder.name()
|
||||
if (!modFolder.isDirectory || modName.startsWith('.'))
|
||||
continue
|
||||
val modFiles = modFolder.child("jsons/TileSets").list().asSequence()
|
||||
val modFiles = modFolder.child("jsons/TileSets").list().toList()
|
||||
loadConfigFiles(modFiles, modName)
|
||||
}
|
||||
|
||||
@ -77,7 +78,7 @@ object TileSetCache : HashMap<String, TileSet>() {
|
||||
assembleTileSetConfigs(hashSetOf()) // no game is loaded, this is just the initial game setup
|
||||
}
|
||||
|
||||
private fun loadConfigFiles(files: Sequence<FileHandle>, configId: String) {
|
||||
private fun loadConfigFiles(files: List<FileHandle>, configId: String) {
|
||||
for (configFile in files) {
|
||||
// jsons/TileSets shouldn't have subfolders, but if a mad modder has one, don't crash (file.readString would throw):
|
||||
if (configFile.isDirectory) continue
|
||||
|
@ -22,9 +22,9 @@ import com.unciv.logic.trade.TradeType.WarDeclaration
|
||||
import com.unciv.logic.trade.TradeType.values
|
||||
import com.unciv.models.ruleset.tile.ResourceSupplyList
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.components.widgets.ExpanderTab
|
||||
import com.unciv.ui.components.extensions.disable
|
||||
import com.unciv.ui.components.input.onClick
|
||||
import com.unciv.ui.components.widgets.ExpanderTab
|
||||
import com.unciv.ui.images.IconTextButton
|
||||
import com.unciv.ui.images.ImageGetter
|
||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||
@ -45,6 +45,11 @@ class OffersListScroll(
|
||||
|
||||
private val expanderTabs = HashMap<TradeType, ExpanderTab>()
|
||||
|
||||
init {
|
||||
fadeScrollBars=false
|
||||
setScrollbarsVisible(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param offersToDisplay The offers which should be displayed as buttons
|
||||
* @param otherOffers The list of other side's offers to compare with whether these offers are unique
|
||||
|
Loading…
Reference in New Issue
Block a user