Avoid List.removeFirst() not being available on Android API 21..34 levels (#13567)

This commit is contained in:
SomeTroglodyte 2025-07-03 09:24:01 +02:00 committed by GitHub
parent 06d6a1bfe1
commit 834239774a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 6 deletions

View File

@ -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()
}
}

View File

@ -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())

View File

@ -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

View File

@ -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)
}
}