From 0468adc130f134d0d5e0c5a5ab5258fef4a5d532 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 13 Jun 2018 13:27:59 +0300 Subject: [PATCH] If the selected unit was a civilian unit of ours that was captured, it is no longer selected. --- .../com/unciv/ui/worldscreen/unit/UnitTable.kt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt index 8b40032eb8..fe16442b4b 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitTable.kt @@ -38,11 +38,18 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){ if(selectedUnit!=null) { - try{ selectedUnit!!.getTile()} - catch(ex:Exception) { - selectedUnit=null; - currentlyExecutingAction=null - } // The unit that was there no longer exists} + if(selectedUnit!!.civInfo != worldScreen.civInfo) { // The unit that was selected, was captured. It exists but is no longer ours. + selectedUnit = null + currentlyExecutingAction = null + } + else { + try { + selectedUnit!!.getTile() + } catch (ex: Exception) { // The unit that was there no longer exists} + selectedUnit = null + currentlyExecutingAction = null + } + } } if(selectedUnit!=null) {