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 {
|
fun getSave(GameName: String, multiplayer: Boolean = false): FileHandle {
|
||||||
val localfile = Gdx.files.local("${getSubfolder(multiplayer)}/$GameName")
|
val localfile = Gdx.files.local("${getSubfolder(multiplayer)}/$GameName")
|
||||||
if(externalFilesDirForAndroid=="" || !Gdx.files.isExternalStorageAvailable) return localfile
|
if (externalFilesDirForAndroid == "" || !Gdx.files.isExternalStorageAvailable) return localfile
|
||||||
val externalFile = Gdx.files.absolute(externalFilesDirForAndroid+"/${getSubfolder(multiplayer)}/$GameName")
|
val externalFile = Gdx.files.absolute(externalFilesDirForAndroid + "/${getSubfolder(multiplayer)}/$GameName")
|
||||||
if(localfile.exists() && !externalFile.exists()) return localfile
|
if (localfile.exists() && !externalFile.exists()) return localfile
|
||||||
return externalFile
|
return externalFile
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getSaves(multiplayer: Boolean = false): List<String> {
|
fun getSaves(multiplayer: Boolean = false): List<String> {
|
||||||
val localSaves = Gdx.files.local(getSubfolder(multiplayer)).list().map { it.name() }
|
val localSaves = Gdx.files.local(getSubfolder(multiplayer)).list().map { it.name() }
|
||||||
if(externalFilesDirForAndroid=="" || !Gdx.files.isExternalStorageAvailable) return localSaves
|
if (externalFilesDirForAndroid == "" || !Gdx.files.isExternalStorageAvailable) return localSaves
|
||||||
return localSaves + Gdx.files.absolute(externalFilesDirForAndroid+"/${getSubfolder(multiplayer)}").list().map { it.name() }
|
return localSaves + Gdx.files.absolute(externalFilesDirForAndroid + "/${getSubfolder(multiplayer)}").list().map { it.name() }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saveGame(game: GameInfo, GameName: String, multiplayer: Boolean = false) {
|
fun saveGame(game: GameInfo, GameName: String, multiplayer: Boolean = false) {
|
||||||
|
|
|
@ -108,8 +108,15 @@ class CityExpansionManager {
|
||||||
|
|
||||||
fun relinquishOwnership(tileInfo: TileInfo) {
|
fun relinquishOwnership(tileInfo: TileInfo) {
|
||||||
cityInfo.tiles = cityInfo.tiles.withoutItem(tileInfo.position)
|
cityInfo.tiles = cityInfo.tiles.withoutItem(tileInfo.position)
|
||||||
if (cityInfo.workedTiles.contains(tileInfo.position))
|
for (city in cityInfo.civInfo.cities) {
|
||||||
cityInfo.workedTiles = cityInfo.workedTiles.withoutItem(tileInfo.position)
|
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
|
tileInfo.owningCity = null
|
||||||
|
|
||||||
cityInfo.civInfo.updateDetailedCivResources()
|
cityInfo.civInfo.updateDetailedCivResources()
|
||||||
|
|
|
@ -101,11 +101,7 @@ class PopulationManager {
|
||||||
if (valueBestTile > valueBestSpecialist) {
|
if (valueBestTile > valueBestSpecialist) {
|
||||||
if (bestTile != null)
|
if (bestTile != null)
|
||||||
cityInfo.workedTiles = cityInfo.workedTiles.withItem(bestTile.position)
|
cityInfo.workedTiles = cityInfo.workedTiles.withItem(bestTile.position)
|
||||||
} else {
|
} else if (bestJob != null) specialists.add(bestJob, 1f)
|
||||||
if (bestJob != null) {
|
|
||||||
specialists.add(bestJob, 1f)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun unassignExtraPopulation() {
|
fun unassignExtraPopulation() {
|
||||||
|
|
Loading…
Reference in a new issue