Resolved #2864 - Locks on tiles are removed when the tile is no longer under your control
This commit is contained in:
parent
1a558a70d2
commit
3f44e1c519
3 changed files with 15 additions and 12 deletions
|
@ -25,16 +25,16 @@ object GameSaver {
|
|||
|
||||
fun getSave(GameName: String, multiplayer: Boolean = false): FileHandle {
|
||||
val localfile = Gdx.files.local("${getSubfolder(multiplayer)}/$GameName")
|
||||
if(externalFilesDirForAndroid=="" || !Gdx.files.isExternalStorageAvailable) return localfile
|
||||
val externalFile = Gdx.files.absolute(externalFilesDirForAndroid+"/${getSubfolder(multiplayer)}/$GameName")
|
||||
if(localfile.exists() && !externalFile.exists()) return localfile
|
||||
if (externalFilesDirForAndroid == "" || !Gdx.files.isExternalStorageAvailable) return localfile
|
||||
val externalFile = Gdx.files.absolute(externalFilesDirForAndroid + "/${getSubfolder(multiplayer)}/$GameName")
|
||||
if (localfile.exists() && !externalFile.exists()) return localfile
|
||||
return externalFile
|
||||
}
|
||||
|
||||
fun getSaves(multiplayer: Boolean = false): List<String> {
|
||||
val localSaves = Gdx.files.local(getSubfolder(multiplayer)).list().map { it.name() }
|
||||
if(externalFilesDirForAndroid=="" || !Gdx.files.isExternalStorageAvailable) return localSaves
|
||||
return localSaves + Gdx.files.absolute(externalFilesDirForAndroid+"/${getSubfolder(multiplayer)}").list().map { it.name() }
|
||||
if (externalFilesDirForAndroid == "" || !Gdx.files.isExternalStorageAvailable) return localSaves
|
||||
return localSaves + Gdx.files.absolute(externalFilesDirForAndroid + "/${getSubfolder(multiplayer)}").list().map { it.name() }
|
||||
}
|
||||
|
||||
fun saveGame(game: GameInfo, GameName: String, multiplayer: Boolean = false) {
|
||||
|
|
|
@ -108,8 +108,15 @@ class CityExpansionManager {
|
|||
|
||||
fun relinquishOwnership(tileInfo: TileInfo) {
|
||||
cityInfo.tiles = cityInfo.tiles.withoutItem(tileInfo.position)
|
||||
if (cityInfo.workedTiles.contains(tileInfo.position))
|
||||
cityInfo.workedTiles = cityInfo.workedTiles.withoutItem(tileInfo.position)
|
||||
for (city in cityInfo.civInfo.cities) {
|
||||
if (city.workedTiles.contains(tileInfo.position)) {
|
||||
city.workedTiles = city.workedTiles.withoutItem(tileInfo.position)
|
||||
city.population.autoAssignPopulation()
|
||||
}
|
||||
if (city.lockedTiles.contains(tileInfo.position))
|
||||
city.lockedTiles.remove(tileInfo.position)
|
||||
}
|
||||
|
||||
tileInfo.owningCity = null
|
||||
|
||||
cityInfo.civInfo.updateDetailedCivResources()
|
||||
|
|
|
@ -101,11 +101,7 @@ class PopulationManager {
|
|||
if (valueBestTile > valueBestSpecialist) {
|
||||
if (bestTile != null)
|
||||
cityInfo.workedTiles = cityInfo.workedTiles.withItem(bestTile.position)
|
||||
} else {
|
||||
if (bestJob != null) {
|
||||
specialists.add(bestJob, 1f)
|
||||
}
|
||||
}
|
||||
} else if (bestJob != null) specialists.add(bestJob, 1f)
|
||||
}
|
||||
|
||||
fun unassignExtraPopulation() {
|
||||
|
|
Loading…
Reference in a new issue