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