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() {
|
internal fun updateTiles() {
|
||||||
|
val civViewableTiles = civInfo.getViewableTiles().toHashSet()
|
||||||
|
|
||||||
for (WG in tileGroups.values){
|
for (WG in tileGroups.values){
|
||||||
WG.update(false)
|
WG.update(civViewableTiles.contains(WG.tileInfo))
|
||||||
}
|
|
||||||
|
|
||||||
val civViewableTiles = civInfo.getViewableTiles()
|
|
||||||
for (string in civViewableTiles
|
|
||||||
.filter { tileGroups.containsKey(it) }) {
|
|
||||||
|
|
||||||
tileGroups[string]!!.run {
|
|
||||||
update(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(worldScreen.bottomBar.unitTable.selectedUnit!=null){
|
if(worldScreen.bottomBar.unitTable.selectedUnit!=null){
|
||||||
val unit = worldScreen.bottomBar.unitTable.selectedUnit!!
|
val unit = worldScreen.bottomBar.unitTable.selectedUnit!!
|
||||||
tileGroups[unit.getTile()]!!.addWhiteHaloAroundUnit()
|
tileGroups[unit.getTile()]!!.addWhiteHaloAroundUnit()
|
||||||
val attackableTiles:List<TileInfo>
|
|
||||||
when(unit.getBaseUnit().unitType){
|
val attackableTiles: List<TileInfo> = when(unit.getBaseUnit().unitType){
|
||||||
UnitType.Civilian -> attackableTiles = listOf()
|
UnitType.Civilian -> listOf()
|
||||||
UnitType.Melee, UnitType.Mounted -> attackableTiles = unit.getDistanceToTiles().keys.toList()
|
UnitType.Melee, UnitType.Mounted -> unit.getDistanceToTiles().keys.toList()
|
||||||
UnitType.Archery, UnitType.Siege -> attackableTiles = unit.getTile().getTilesInDistance(2)
|
UnitType.Archery, UnitType.Siege -> unit.getTile().getTilesInDistance(2)
|
||||||
UnitType.City -> throw Exception("A unit shouldn't have a City unittype!")
|
UnitType.City -> throw Exception("A unit shouldn't have a City unittype!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||||
|
|
||||||
game.gameInfo.nextTurn()
|
game.gameInfo.nextTurn()
|
||||||
bottomBar.unitTable.currentlyExecutingAction = null
|
bottomBar.unitTable.currentlyExecutingAction = null
|
||||||
GameSaver.saveGame(game.gameInfo, "Autosave")
|
kotlin.concurrent.thread { GameSaver.saveGame(game.gameInfo, "Autosave") }
|
||||||
update()
|
update()
|
||||||
displayTutorials("NextTurn")
|
displayTutorials("NextTurn")
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){
|
||||||
|
|
||||||
unitDescriptionLabel.setText(unitLabelText)
|
unitDescriptionLabel.setText(unitLabelText)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
unitNameLabel.setText("")
|
unitNameLabel.setText("")
|
||||||
|
|
Loading…
Reference in a new issue