Moved autosave to a concurrent thread so you won't have to wait for it to finish saving to continue your game
UpdateTiles is now cleaner - doesn't update viewed tiles twice, only once
This commit is contained in:
parent
14a1bc5626
commit
36f9ba6f8c
3 changed files with 9 additions and 17 deletions
|
@ -85,27 +85,20 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
|||
}
|
||||
|
||||
internal fun updateTiles() {
|
||||
val civViewableTiles = civInfo.getViewableTiles().toHashSet()
|
||||
|
||||
for (WG in tileGroups.values){
|
||||
WG.update(false)
|
||||
}
|
||||
|
||||
val civViewableTiles = civInfo.getViewableTiles()
|
||||
for (string in civViewableTiles
|
||||
.filter { tileGroups.containsKey(it) }) {
|
||||
|
||||
tileGroups[string]!!.run {
|
||||
update(true)
|
||||
}
|
||||
WG.update(civViewableTiles.contains(WG.tileInfo))
|
||||
}
|
||||
|
||||
if(worldScreen.bottomBar.unitTable.selectedUnit!=null){
|
||||
val unit = worldScreen.bottomBar.unitTable.selectedUnit!!
|
||||
tileGroups[unit.getTile()]!!.addWhiteHaloAroundUnit()
|
||||
val attackableTiles:List<TileInfo>
|
||||
when(unit.getBaseUnit().unitType){
|
||||
UnitType.Civilian -> attackableTiles = listOf()
|
||||
UnitType.Melee, UnitType.Mounted -> attackableTiles = unit.getDistanceToTiles().keys.toList()
|
||||
UnitType.Archery, UnitType.Siege -> attackableTiles = unit.getTile().getTilesInDistance(2)
|
||||
|
||||
val attackableTiles: List<TileInfo> = when(unit.getBaseUnit().unitType){
|
||||
UnitType.Civilian -> listOf()
|
||||
UnitType.Melee, UnitType.Mounted -> unit.getDistanceToTiles().keys.toList()
|
||||
UnitType.Archery, UnitType.Siege -> unit.getTile().getTilesInDistance(2)
|
||||
UnitType.City -> throw Exception("A unit shouldn't have a City unittype!")
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ class WorldScreen : CameraStageBaseScreen() {
|
|||
|
||||
game.gameInfo.nextTurn()
|
||||
bottomBar.unitTable.currentlyExecutingAction = null
|
||||
GameSaver.saveGame(game.gameInfo, "Autosave")
|
||||
kotlin.concurrent.thread { GameSaver.saveGame(game.gameInfo, "Autosave") }
|
||||
update()
|
||||
displayTutorials("NextTurn")
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){
|
|||
|
||||
unitDescriptionLabel.setText(unitLabelText)
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
unitNameLabel.setText("")
|
||||
|
|
Loading…
Reference in a new issue