Fix isEmbarked() Crash (#6290)

* Correct logic for blocking Naval Melee from capturing Civilians on Land

* Even better solution now that we can move on to unguarded Civilian tiles. But still won't let us capture Civilians if we can't get there

* Make Embarked unable to capture Civilians

* Embarked can't capture Water Civilians

* Fix Gradle Test

* Better unit test without making variable not internal

* attempt not working

* Just make currentTile not internal

* remove debug

* erronious import

* Fix exception for when currentTile isn't initialized yet

* More precise solution

Co-authored-by: itanasi <spellman23@gmail.com>
This commit is contained in:
itanasi 2022-03-07 03:02:30 -08:00 committed by GitHub
parent 28ab45ae40
commit 906d770443
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -486,6 +486,7 @@ class TileMap {
var unitToPlaceTile: TileInfo? = null
// try to place at the original point (this is the most probable scenario)
val currentTile = get(position)
unit.currentTile = currentTile // temporary
if (unit.movement.canMoveTo(currentTile)) unitToPlaceTile = currentTile
// if it's not suitable, try to find another tile nearby