exploredTiles deprecation, step 1 - do not check exploredTiles when checking if a tile is explored (#8747)

exploredTiles continues to remain updated, to allow
This commit is contained in:
Yair Morgenstern
2023-02-26 09:04:14 +02:00
committed by GitHub
parent 9acc84ff8e
commit 87403c9472
2 changed files with 5 additions and 4 deletions

View File

@ -186,6 +186,7 @@ class Civilization : IsPartOfGameInfoSerialization {
// This is basically a way to ensure our lists are immutable.
var cities = listOf<City>()
var citiesCreated = 0
@Deprecated("4.5.0 - in favor of Tile.exploredBy")
var exploredTiles = HashSet<Vector2>()
// Limit camera within explored region

View File

@ -243,20 +243,20 @@ open class Tile : IsPartOfGameInfoSerialization {
fun isExplored(player: Civilization): Boolean {
if (UncivGame.Current.viewEntireMapForDebug || player.isSpectator())
return true
return exploredBy.contains(player.civName) || player.exploredTiles.contains(position)
return exploredBy.contains(player.civName)
}
fun setExplored(player: Civilization, isExplored: Boolean, explorerPosition: Vector2? = null) {
if (isExplored) {
exploredBy.add(player.civName)
player.exploredTiles.add(position)
// Disable the undo button if a new tile has been explored
if (player.exploredTiles.add(position) && GUI.isWorldLoaded()) {
if (exploredBy.add(player.civName) && GUI.isWorldLoaded()) {
val worldScreen = GUI.getWorldScreen()
worldScreen.preActionGameInfo = worldScreen.gameInfo
}
if(player.playerType == PlayerType.Human)
if (player.playerType == PlayerType.Human)
player.exploredRegion.checkTilePosition(position, explorerPosition)
} else {
exploredBy.remove(player.civName)