mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 21:30:20 +07:00
Application crash after the defeat (#2427)
This commit is contained in:
@ -307,7 +307,7 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
||||
|
||||
|
||||
fun setCenterPosition(vector: Vector2, immediately: Boolean = false, selectUnit: Boolean = true) {
|
||||
val tileGroup = tileGroups.values.first { it.tileInfo.position == vector }
|
||||
val tileGroup = tileGroups.values.firstOrNull { it.tileInfo.position == vector } ?: return
|
||||
selectedTile = tileGroup.tileInfo
|
||||
if(selectUnit)
|
||||
worldScreen.bottomUnitTable.tileSelected(selectedTile!!)
|
||||
|
@ -244,7 +244,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
displayTutorialsOnUpdate()
|
||||
|
||||
bottomUnitTable.update()
|
||||
bottomTileInfoTable.updateTileTable(mapHolder.selectedTile!!)
|
||||
bottomTileInfoTable.updateTileTable(mapHolder.selectedTile)
|
||||
bottomTileInfoTable.x = stage.width - bottomTileInfoTable.width
|
||||
bottomTileInfoTable.y = if (UncivGame.Current.settings.showMinimap) minimapWrapper.height else 0f
|
||||
battleTable.update()
|
||||
|
@ -15,10 +15,10 @@ class TileInfoTable(private val viewingCiv :CivilizationInfo) : Table(CameraStag
|
||||
background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f))
|
||||
}
|
||||
|
||||
internal fun updateTileTable(tile: TileInfo) {
|
||||
internal fun updateTileTable(tile: TileInfo?) {
|
||||
clearChildren()
|
||||
|
||||
if (UncivGame.Current.viewEntireMapForDebug || viewingCiv.exploredTiles.contains(tile.position)) {
|
||||
if ((tile != null) && (UncivGame.Current.viewEntireMapForDebug || viewingCiv.exploredTiles.contains(tile.position))) {
|
||||
add(getStatsTable(tile))
|
||||
add(tile.toString(viewingCiv).toLabel()).colspan(2).pad(10f)
|
||||
}
|
||||
|
Reference in New Issue
Block a user