mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-12 08:49:22 +07:00
Maybe solved a concurrency-related java.lang.IllegalArgumentException from CameraStageBaseScreen.render
It's hard to tell because it only crops extremely randomly in, like, 1 in a 1000 games, and the users just continue on with their lives, But it's a crash record and we want 0 of those!
This commit is contained in:
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.game"
|
applicationId "com.unciv.game"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 182
|
versionCode 183
|
||||||
versionName "2.11.0"
|
versionName "2.11.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Had to add this crap for Travis to build, it wanted to sign the app
|
// Had to add this crap for Travis to build, it wanted to sign the app
|
||||||
|
@ -24,8 +24,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
|||||||
val tileGroups = HashMap<TileInfo, WorldTileGroup>()
|
val tileGroups = HashMap<TileInfo, WorldTileGroup>()
|
||||||
|
|
||||||
var moveToOverlay :Actor?=null
|
var moveToOverlay :Actor?=null
|
||||||
val cityButtonOverlays = ArrayList<Actor>()
|
var removeMoveToOverlay=false
|
||||||
|
|
||||||
|
|
||||||
// Used to transfer data on the "move here" button that should be created, from the side thread to the main thread
|
// Used to transfer data on the "move here" button that should be created, from the side thread to the main thread
|
||||||
class MoveHereButtonDto(val unit: MapUnit, val tileInfo: TileInfo, val turnsToGetThere: Int)
|
class MoveHereButtonDto(val unit: MapUnit, val tileInfo: TileInfo, val turnsToGetThere: Int)
|
||||||
@ -49,6 +48,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
|||||||
val groupSize = 50
|
val groupSize = 50
|
||||||
tileGroup.setPosition(worldScreen.stage.width / 2 + positionalVector.x * 0.8f * groupSize.toFloat(),
|
tileGroup.setPosition(worldScreen.stage.width / 2 + positionalVector.x * 0.8f * groupSize.toFloat(),
|
||||||
worldScreen.stage.height / 2 + positionalVector.y * 0.8f * groupSize.toFloat())
|
worldScreen.stage.height / 2 + positionalVector.y * 0.8f * groupSize.toFloat())
|
||||||
|
|
||||||
tileGroups[tileInfo] = tileGroup
|
tileGroups[tileInfo] = tileGroup
|
||||||
allTiles.addActor(tileGroup)
|
allTiles.addActor(tileGroup)
|
||||||
topX = Math.max(topX, tileGroup.x + groupSize)
|
topX = Math.max(topX, tileGroup.x + groupSize)
|
||||||
@ -168,8 +168,8 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
|||||||
|
|
||||||
// we don't update it directly because we're on a different thread; instead, we tell it to update itself
|
// we don't update it directly because we're on a different thread; instead, we tell it to update itself
|
||||||
worldScreen.shouldUpdate = true
|
worldScreen.shouldUpdate = true
|
||||||
moveToOverlay?.remove()
|
|
||||||
moveToOverlay = null
|
removeMoveToOverlay=true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,12 +182,14 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal fun updateTiles(civInfo: CivilizationInfo) {
|
internal fun updateTiles(civInfo: CivilizationInfo) {
|
||||||
|
if(removeMoveToOverlay){
|
||||||
|
removeMoveToOverlay=false
|
||||||
|
moveToOverlay?.remove()
|
||||||
|
}
|
||||||
|
|
||||||
val playerViewableTilePositions = civInfo.viewableTiles.map { it.position }.toHashSet()
|
val playerViewableTilePositions = civInfo.viewableTiles.map { it.position }.toHashSet()
|
||||||
val playerViewableInvisibleUnitsTilePositions = civInfo.viewableInvisibleUnitsTiles.map { it.position }.toHashSet()
|
val playerViewableInvisibleUnitsTilePositions = civInfo.viewableInvisibleUnitsTiles.map { it.position }.toHashSet()
|
||||||
|
|
||||||
cityButtonOverlays.forEach{it.remove()}
|
|
||||||
cityButtonOverlays.clear()
|
|
||||||
|
|
||||||
for (tileGroup in tileGroups.values){
|
for (tileGroup in tileGroups.values){
|
||||||
val canSeeTile = UnCivGame.Current.viewEntireMapForDebug
|
val canSeeTile = UnCivGame.Current.viewEntireMapForDebug
|
||||||
|| playerViewableTilePositions.contains(tileGroup.tileInfo.position)
|
|| playerViewableTilePositions.contains(tileGroup.tileInfo.position)
|
||||||
|
Reference in New Issue
Block a user