mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-21 10:25:10 -04:00
Avoid List.removeFirst() not being available on Android API 21..34 levels (#13567)
This commit is contained in:
parent
06d6a1bfe1
commit
834239774a
@ -45,7 +45,7 @@ class ThreatManager(val civInfo: Civilization) {
|
||||
else enemyTile.second.coerceAtMost(maxDist)
|
||||
} else {
|
||||
// This tile is no longer valid
|
||||
tilesWithEnemies.removeFirst()
|
||||
tilesWithEnemies.removeAt(0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,4 +184,3 @@ class ThreatManager(val civInfo: Civilization) {
|
||||
distanceToClosestEnemyTiles.clear()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ class TurnManager(val civInfo: Civilization) {
|
||||
notificationsThisTurn.notifications.addAll(civInfo.notifications)
|
||||
|
||||
while (notificationsLog.size >= UncivGame.Current.settings.notificationsLogMaxTurns) {
|
||||
notificationsLog.removeFirst()
|
||||
notificationsLog.removeAt(0)
|
||||
}
|
||||
|
||||
if (notificationsThisTurn.notifications.isNotEmpty())
|
||||
|
@ -317,13 +317,13 @@ class MapGenerator(val ruleset: Ruleset, private val coroutineScope: CoroutineSc
|
||||
val maxLakeSize = ruleset.modOptions.constants.maxLakeSize
|
||||
|
||||
while (waterTiles.isNotEmpty()) {
|
||||
val initialWaterTile = waterTiles.removeFirst()
|
||||
val initialWaterTile = waterTiles.removeAt(0)
|
||||
tilesInArea += initialWaterTile
|
||||
tilesToCheck += initialWaterTile
|
||||
|
||||
// Floodfill to cluster water tiles
|
||||
while (tilesToCheck.isNotEmpty()) {
|
||||
val tileWeAreChecking = tilesToCheck.removeFirst()
|
||||
val tileWeAreChecking = tilesToCheck.removeAt(0)
|
||||
for (vector in tileWeAreChecking.neighbors){
|
||||
if (tilesInArea.contains(vector)) continue
|
||||
if (!waterTiles.contains(vector)) continue
|
||||
|
@ -1039,7 +1039,7 @@ class MapUnit : IsPartOfGameInfoSerialization {
|
||||
// When in the unit's turn— I.E. For a player unit— The last two entries will be from .endTurn() followed by from .startTurn(), so the segment from .movementMemories will have zero length. Instead, what gets seen will be the segment from the end of .movementMemories to the unit's current position.
|
||||
// When not in the unit's turn— I.E. For a foreign unit— The segment from the end of .movementMemories to the unit's current position will have zero length, while the last two entries here will be from .startTurn() followed by .endTurn(), so the segment here will be what gets shown.
|
||||
// The exception is when a unit changes position when not in its turn, such as by melee withdrawal or foreign territory expulsion. Then the segment here and the segment from the end of here to the current position can both be shown.
|
||||
movementMemories.removeFirst()
|
||||
movementMemories.removeAt(0)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user