mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
Fix the missing overlays caused by commit 0ffb038129b14ec696373bfc188b796ff1aefe93 (#2586)
This commit is contained in:
parent
647a0c9ff7
commit
91c1e0ae6d
@ -94,8 +94,10 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||||||
|
|
||||||
private fun addTileOverlaysWithUnitMovement(selectedUnit: MapUnit, tileInfo: TileInfo) {
|
private fun addTileOverlaysWithUnitMovement(selectedUnit: MapUnit, tileInfo: TileInfo) {
|
||||||
// some code is copied from canReach not to call getShortestPath on the main thread before calling it on this thread
|
// some code is copied from canReach not to call getShortestPath on the main thread before calling it on this thread
|
||||||
if (selectedUnit.type.isAirUnit() && selectedUnit.currentTile.aerialDistanceTo(tileInfo) > selectedUnit.getRange()*2)
|
if (selectedUnit.type.isAirUnit() && selectedUnit.currentTile.aerialDistanceTo(tileInfo) > selectedUnit.getRange()*2) {
|
||||||
|
addTileOverlays(tileInfo)
|
||||||
return
|
return
|
||||||
|
}
|
||||||
thread(name="TurnsToGetThere") {
|
thread(name="TurnsToGetThere") {
|
||||||
/** LibGdx sometimes has these weird errors when you try to edit the UI layout from 2 separate threads.
|
/** LibGdx sometimes has these weird errors when you try to edit the UI layout from 2 separate threads.
|
||||||
* And so, all UI editing will be done on the main thread.
|
* And so, all UI editing will be done on the main thread.
|
||||||
@ -104,8 +106,6 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||||||
*/
|
*/
|
||||||
val turnsToGetThere = if(selectedUnit.type.isAirUnit()) 1
|
val turnsToGetThere = if(selectedUnit.type.isAirUnit()) 1
|
||||||
else selectedUnit.movement.getShortestPath(tileInfo).size // this is what takes the most time, tbh
|
else selectedUnit.movement.getShortestPath(tileInfo).size // this is what takes the most time, tbh
|
||||||
if (turnsToGetThere == 0) // there is no path to tileInfo
|
|
||||||
return@thread
|
|
||||||
|
|
||||||
Gdx.app.postRunnable {
|
Gdx.app.postRunnable {
|
||||||
if(UncivGame.Current.settings.singleTapMove && turnsToGetThere==1) {
|
if(UncivGame.Current.settings.singleTapMove && turnsToGetThere==1) {
|
||||||
@ -113,8 +113,9 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
|
|||||||
selectedUnit.movement.headTowards(tileInfo)
|
selectedUnit.movement.headTowards(tileInfo)
|
||||||
worldScreen.bottomUnitTable.selectedUnit = selectedUnit // keep moved unit selected
|
worldScreen.bottomUnitTable.selectedUnit = selectedUnit // keep moved unit selected
|
||||||
} else {
|
} else {
|
||||||
// add "move to" button
|
// add "move to" button if there is a path to tileInfo
|
||||||
val moveHereButtonDto = MoveHereButtonDto(selectedUnit, tileInfo, turnsToGetThere)
|
val moveHereButtonDto = if (turnsToGetThere != 0) MoveHereButtonDto(selectedUnit, tileInfo, turnsToGetThere)
|
||||||
|
else null
|
||||||
addTileOverlays(tileInfo, moveHereButtonDto)
|
addTileOverlays(tileInfo, moveHereButtonDto)
|
||||||
}
|
}
|
||||||
worldScreen.shouldUpdate = true
|
worldScreen.shouldUpdate = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user