From 004cc58e13f1dba44030677b331b8fd155a40311 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 8 Feb 2021 21:48:37 +0200 Subject: [PATCH] Units manually moved cancel existing move action --- core/src/com/unciv/ui/worldscreen/WorldMapHolder.kt | 3 ++- core/src/com/unciv/ui/worldscreen/mainmenu/DropBox.kt | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/ui/worldscreen/WorldMapHolder.kt b/core/src/com/unciv/ui/worldscreen/WorldMapHolder.kt index cacd072a99..68d169a878 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldMapHolder.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldMapHolder.kt @@ -166,7 +166,8 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap // 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 + if (selectedUnit.action == Constants.unitActionExplore || selectedUnit.isMoving()) + 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() diff --git a/core/src/com/unciv/ui/worldscreen/mainmenu/DropBox.kt b/core/src/com/unciv/ui/worldscreen/mainmenu/DropBox.kt index 3b935e55da..ea48f7455a 100644 --- a/core/src/com/unciv/ui/worldscreen/mainmenu/DropBox.kt +++ b/core/src/com/unciv/ui/worldscreen/mainmenu/DropBox.kt @@ -185,8 +185,8 @@ object Github { return GameSaver.json().fromJson(RepoSearch::class.java, inputStream.bufferedReader().readText()).items } - class RepoSearch{ - var items=ArrayList() + class RepoSearch { + var items = ArrayList() } class Repo {