Resolved #2278 - various exploration-related improvements

This commit is contained in:
Yair Morgenstern 2020-04-13 23:08:45 +03:00
parent dd8acda4c0
commit b441d537a5
3 changed files with 4 additions and 2 deletions

View File

@ -385,5 +385,6 @@ object UnitAutomation {
if (unit.health < 80 && tryHealUnit(unit)) return
if (tryExplore(unit)) return
unit.civInfo.addNotification("[${unit.name}] finished exploring.", unit.currentTile.position, Color.GRAY)
unit.action = null
}
}

View File

@ -200,8 +200,8 @@ object UnitActions {
actionList += UnitAction(
type = UnitActionType.Explore,
action = {
UnitAutomation.automatedExplore(unit)
unit.action = Constants.unitActionExplore
if(unit.currentMovement>0) UnitAutomation.automatedExplore(unit)
})
} else {
actionList += UnitAction(

View File

@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
import com.badlogic.gdx.scenes.scene2d.Actor
import com.badlogic.gdx.scenes.scene2d.ui.Button
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
import com.unciv.Constants
import com.unciv.logic.map.MapUnit
import com.unciv.logic.map.TileInfo
import com.unciv.logic.map.action.BuildLongRoadAction
@ -75,6 +76,7 @@ class UnitContextMenu(val tileMapHolder: WorldMapHolder, val selectedUnit: MapUn
// I can't think of any way to avoid this,
// but it's so rare and edge-case-y that ignoring its failure is actually acceptable, hence the empty catch
selectedUnit.movement.moveToTile(tileToMoveTo)
if(selectedUnit.action == Constants.unitActionExplore) selectedUnit.action = null // remove explore on manual move
Sounds.play(UncivSound.Whoosh)
if (selectedUnit.currentTile != targetTile)
selectedUnit.action = "moveTo " + targetTile.position.x.toInt() + "," + targetTile.position.y.toInt()
@ -82,7 +84,6 @@ class UnitContextMenu(val tileMapHolder: WorldMapHolder, val selectedUnit: MapUn
tileMapHolder.worldScreen.bottomUnitTable.selectedUnit = selectedUnit
}
// we don't update it directly because we're on a different thread; instead, we tell it to update itself
tileMapHolder.worldScreen.shouldUpdate = true
tileMapHolder.unitActionOverlay?.remove()
} catch (e: Exception) {