From 9e5208dd8cab1379760e04e259e223e5d2084eed Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 29 Aug 2018 12:25:35 +0300 Subject: [PATCH] Fixed a bug where the unit needs the civInfo in order to calculate the moveTo even before it's put on the map. --- Credits.md | 10 +++++----- android/build.gradle | 4 ++-- .../com/unciv/logic/civilization/DiplomacyManager.kt | 2 +- core/src/com/unciv/logic/map/TileMap.kt | 6 ++++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Credits.md b/Credits.md index 149383149d..92dc32773c 100644 --- a/Credits.md +++ b/Credits.md @@ -74,8 +74,8 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc * [Factory](https://thenounproject.com/term/factory/1049531/) By RULI * [Mine](https://thenounproject.com/term/mine/543/) By Edward Boatman * [Corral](https://thenounproject.com/term/corral/1340751/) By Luis Prado -* [Connection](https://thenounproject.com/search/?q=connection&i=1521886) By Travis Avery -* [Connection](https://thenounproject.com/search/?q=connection&i=1521886) By Travis Avery -* [Connection](https://thenounproject.com/search/?q=connection&i=1521886) By Travis Avery -* [Connection](https://thenounproject.com/search/?q=connection&i=1521886) By Travis Avery -* [Connection](https://thenounproject.com/search/?q=connection&i=1521886) By Travis Avery \ No newline at end of file +* [Plants](https://thenounproject.com/term/plants/1760916/) By hendra sudibyo +* [Pickaxe](https://thenounproject.com/term/pickaxe/175792/) By Creative Stall +* [Food stall](https://thenounproject.com/term/food-stall/1618358/) By I Putu Kharismayadi +* [Road](https://thenounproject.com/term/road/1600491/) By REVA +* [Circle](https://thenounproject.com/term/circle/1841891/) By Aybige \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 96bcfb17a3..7e5f2b14ab 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.unciv.game" minSdkVersion 14 targetSdkVersion 26 - versionCode 130 - versionName "2.7.14" + versionCode 131 + versionName "2.7.15" } buildTypes { release { diff --git a/core/src/com/unciv/logic/civilization/DiplomacyManager.kt b/core/src/com/unciv/logic/civilization/DiplomacyManager.kt index 98225cc791..33d270be47 100644 --- a/core/src/com/unciv/logic/civilization/DiplomacyManager.kt +++ b/core/src/com/unciv/logic/civilization/DiplomacyManager.kt @@ -102,7 +102,7 @@ class DiplomacyManager() { fun declareWar(){ diplomaticStatus = DiplomaticStatus.War otherCiv().diplomacy[civInfo.civName]!!.diplomaticStatus = DiplomaticStatus.War - otherCiv().addNotification("[civName] has declared war on us!",null, Color.RED) + otherCiv().addNotification("[${civInfo.civName}] has declared war on us!",null, Color.RED) } //endregion } \ No newline at end of file diff --git a/core/src/com/unciv/logic/map/TileMap.kt b/core/src/com/unciv/logic/map/TileMap.kt index e1d5078f37..9d6225744a 100644 --- a/core/src/com/unciv/logic/map/TileMap.kt +++ b/core/src/com/unciv/logic/map/TileMap.kt @@ -63,12 +63,14 @@ class TileMap { val tilesInDistance = getTilesInDistance(position, 2) - unit.owner=civInfo.civName // needed in order to calculate canMoveTo + unit.assignOwner(civInfo) // both the civ name and actual civ need to be in here in order to calculate the canMoveTo...Darn val unitToPlaceTile = tilesInDistance.firstOrNull { unit.canMoveTo(it) } if(unitToPlaceTile!=null) { + // only once we know the unit can be placed do we add it to the civ's unit list unit.putInTile(unitToPlaceTile) - unit.assignOwner(civInfo) // only once we know the unit can be placed do we add it to the civ's unit list } + else civInfo.units.remove(unit) // since we added it to the civ units in the previous assignOwner + return unit }