mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04:00
Fixed switching unit selection bug - #804
This commit is contained in:
parent
a67fc9d55d
commit
9352243eb4
@ -21,8 +21,8 @@ android {
|
||||
applicationId "com.unciv.app"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 28
|
||||
versionCode 246
|
||||
versionName "2.16.9"
|
||||
versionCode 247
|
||||
versionName "2.16.10"
|
||||
}
|
||||
|
||||
// Had to add this crap for Travis to build, it wanted to sign the app
|
||||
|
@ -89,17 +89,17 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
||||
unitActionOverlay?.remove()
|
||||
selectedTile = tileInfo
|
||||
|
||||
val selectedUnit = worldScreen.bottomBar.unitTable.selectedUnit
|
||||
val previousSelectedUnit = worldScreen.bottomBar.unitTable.selectedUnit
|
||||
worldScreen.bottomBar.unitTable.tileSelected(tileInfo)
|
||||
val newSelectedUnit = worldScreen.bottomBar.unitTable.selectedUnit
|
||||
|
||||
if (selectedUnit != null && selectedUnit.getTile() != tileInfo
|
||||
&& selectedUnit.canMoveTo(tileInfo) && selectedUnit.movementAlgs().canReach(tileInfo)) {
|
||||
if (previousSelectedUnit != null && previousSelectedUnit.getTile() != tileInfo
|
||||
&& previousSelectedUnit.canMoveTo(tileInfo) && previousSelectedUnit.movementAlgs().canReach(tileInfo)) {
|
||||
// this can take a long time, because of the unit-to-tile calculation needed, so we put it in a different thread
|
||||
moveHere(selectedUnit, tileInfo)
|
||||
worldScreen.bottomBar.unitTable.selectedUnit = selectedUnit // keep moved unit selected
|
||||
moveHere(previousSelectedUnit, tileInfo)
|
||||
}
|
||||
|
||||
if(selectedUnit==null || selectedUnit.type==UnitType.Civilian){
|
||||
if(newSelectedUnit==null || newSelectedUnit.type==UnitType.Civilian){
|
||||
val unitsInTile = selectedTile!!.getUnits()
|
||||
if(unitsInTile.isNotEmpty() && unitsInTile.first().civInfo.isAtWarWith(worldScreen.currentPlayerCiv)){
|
||||
// try to select the closest city to bombard this guy
|
||||
@ -127,6 +127,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
||||
if(UnCivGame.Current.settings.singleTapMove && turnsToGetThere==1) {
|
||||
// single turn instant move
|
||||
selectedUnit.movementAlgs().headTowards(tileInfo)
|
||||
worldScreen.bottomBar.unitTable.selectedUnit = selectedUnit // keep moved unit selected
|
||||
} else {
|
||||
// add "move to" button
|
||||
val moveHereButtonDto = MoveHereButtonDto(selectedUnit, tileInfo, turnsToGetThere)
|
||||
|
Loading…
x
Reference in New Issue
Block a user