mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
Linting
This commit is contained in:
parent
8e900a2503
commit
20cf0c9203
@ -168,12 +168,10 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
|
|||||||
val specialConstructions = ArrayList<Table>()
|
val specialConstructions = ArrayList<Table>()
|
||||||
|
|
||||||
thread {
|
thread {
|
||||||
|
// Since this can be a heavy operation and leads to many ANRs on older phones we put the metadata-gathering in another thread.
|
||||||
val constructionButtonDTOList = getConstructionButtonDTOs() // Since this can be a heavy operation and leads to many ANRs on older phones...
|
val constructionButtonDTOList = getConstructionButtonDTOs()
|
||||||
Gdx.app.postRunnable {
|
Gdx.app.postRunnable {
|
||||||
// For some bizarre reason, moving this to another thread messes up the entire construction list?! Haven't figured out why yet
|
|
||||||
availableConstructionsTable.clear()
|
availableConstructionsTable.clear()
|
||||||
|
|
||||||
for (dto in constructionButtonDTOList) {
|
for (dto in constructionButtonDTOList) {
|
||||||
val constructionButton = getConstructionButton(dto)
|
val constructionButton = getConstructionButton(dto)
|
||||||
when (dto.construction) {
|
when (dto.construction) {
|
||||||
|
@ -112,8 +112,10 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||||||
|
|
||||||
if (previousSelectedUnits.isNotEmpty() && previousSelectedUnits.any { it.getTile() != tileInfo }
|
if (previousSelectedUnits.isNotEmpty() && previousSelectedUnits.any { it.getTile() != tileInfo }
|
||||||
&& worldScreen.isPlayersTurn
|
&& worldScreen.isPlayersTurn
|
||||||
&& previousSelectedUnits.any { it.movement.canMoveTo(tileInfo) ||
|
&& previousSelectedUnits.any {
|
||||||
it.movement.isUnknownTileWeShouldAssumeToBePassable(tileInfo)}) {
|
it.movement.canMoveTo(tileInfo) ||
|
||||||
|
it.movement.isUnknownTileWeShouldAssumeToBePassable(tileInfo)
|
||||||
|
}) {
|
||||||
// this can take a long time, because of the unit-to-tile calculation needed, so we put it in a different thread
|
// this can take a long time, because of the unit-to-tile calculation needed, so we put it in a different thread
|
||||||
addTileOverlaysWithUnitMovement(previousSelectedUnits, tileInfo)
|
addTileOverlaysWithUnitMovement(previousSelectedUnits, tileInfo)
|
||||||
} else addTileOverlays(tileInfo) // no unit movement but display the units in the tile etc.
|
} else addTileOverlays(tileInfo) // no unit movement but display the units in the tile etc.
|
||||||
@ -387,15 +389,15 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||||||
val attackableTiles: List<AttackableTile> = if (unit.type.isCivilian()) listOf()
|
val attackableTiles: List<AttackableTile> = if (unit.type.isCivilian()) listOf()
|
||||||
else {
|
else {
|
||||||
BattleHelper.getAttackableEnemies(unit, unit.movement.getDistanceToTiles())
|
BattleHelper.getAttackableEnemies(unit, unit.movement.getDistanceToTiles())
|
||||||
.filter { (UncivGame.Current.viewEntireMapForDebug ||
|
.filter {
|
||||||
playerViewableTilePositions.contains(it.tileToAttack.position)) }
|
(UncivGame.Current.viewEntireMapForDebug ||
|
||||||
|
playerViewableTilePositions.contains(it.tileToAttack.position))
|
||||||
|
}
|
||||||
.distinctBy { it.tileToAttack }
|
.distinctBy { it.tileToAttack }
|
||||||
}
|
}
|
||||||
|
|
||||||
for (attackableTile in attackableTiles) {
|
for (attackableTile in attackableTiles) {
|
||||||
|
|
||||||
tileGroups[attackableTile.tileToAttack]!!.showCircle(colorFromRGB(237, 41, 57))
|
tileGroups[attackableTile.tileToAttack]!!.showCircle(colorFromRGB(237, 41, 57))
|
||||||
|
|
||||||
tileGroups[attackableTile.tileToAttack]!!.showCrosshair(
|
tileGroups[attackableTile.tileToAttack]!!.showCrosshair(
|
||||||
// the targets which cannot be attacked without movements shown as orange-ish
|
// the targets which cannot be attacked without movements shown as orange-ish
|
||||||
if (attackableTile.tileToAttackFrom != unit.currentTile)
|
if (attackableTile.tileToAttackFrom != unit.currentTile)
|
||||||
@ -489,6 +491,7 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For debugging purposes
|
// For debugging purposes
|
||||||
override fun draw(batch: Batch?, parentAlpha: Float) { super.draw(batch, parentAlpha) }
|
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||||
override fun act(delta: Float) { super.act(delta) }
|
|
||||||
|
override fun act(delta: Float) = super.act(delta)
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user