Minor logic cleanup (#6066)

Co-authored-by: temurakami <spellman23@gmail.com>
This commit is contained in:
itanasi 2022-01-28 00:56:10 -08:00 committed by GitHub
parent 957d5b4008
commit 6a98d8dd70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -619,12 +619,13 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
if (!unit.canEnterForeignTerrain && !tile.canCivPassThrough(unit.civInfo)) return false
val firstUnit = tile.getFirstUnit()
if (firstUnit != null) {
// Moving to non-empty tile
if (firstUnit != null && unit.civInfo != firstUnit.civInfo) {
// Allow movement through unguarded, at-war Civilian Unit. Capture on the way
if (tile.getUnguardedCivilian() != null && unit.civInfo != firstUnit.civInfo && unit.civInfo.isAtWarWith(tile.civilianUnit!!.civInfo))
if (tile.getUnguardedCivilian() != null && unit.civInfo.isAtWarWith(tile.civilianUnit!!.civInfo))
return true
// Cannot enter hostile tile with any unit in there
if (firstUnit.civInfo != unit.civInfo && unit.civInfo.isAtWarWith(firstUnit.civInfo))
if (unit.civInfo.isAtWarWith(firstUnit.civInfo))
return false
}