mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Resolved race-condition error for loading terrain icons
This commit is contained in:
parent
2a8f0be257
commit
660ae105c3
@ -8,7 +8,9 @@ import com.badlogic.gdx.graphics.glutils.FrameBuffer
|
||||
import com.badlogic.gdx.math.Matrix4
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||
import com.badlogic.gdx.scenes.scene2d.Group
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.models.ruleset.Ruleset
|
||||
import com.unciv.models.tilesets.TileSetCache
|
||||
import com.unciv.ui.components.extensions.center
|
||||
import com.unciv.ui.components.extensions.setSize
|
||||
import com.unciv.ui.components.fonts.FontRulesetIcons.getPixmapFromActor
|
||||
@ -75,6 +77,9 @@ object FontRulesetIcons {
|
||||
addChar(policy.name, ImageGetter.getImage(fileLocation).apply { setSize(Fonts.ORIGINAL_FONT_SIZE) })
|
||||
}
|
||||
|
||||
// Upon *game initialization* we can get here without the tileset being loaded yet
|
||||
// in which case we can't add terrain icons
|
||||
if (TileSetCache.containsKey(UncivGame.Current.settings.tileSet))
|
||||
for (terrain in ruleset.terrains.values) {
|
||||
// These ensure that the font icons are correctly sized - tilegroup rendering works differently than others, to account for clickability vs rendered areas
|
||||
val tileGroup = CivilopediaImageGetters.terrainImage(terrain, ruleset, Fonts.ORIGINAL_FONT_SIZE)
|
||||
|
Loading…
Reference in New Issue
Block a user