Skip to content

Commit

Permalink
Resolved rare crash when map contains improvements not in ruleset
Browse files Browse the repository at this point in the history
  • Loading branch information
yairm210 committed Oct 20, 2024
1 parent c885e24 commit d164f7b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions core/src/com/unciv/logic/automation/unit/UnitAutomation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ object UnitAutomation {

val tileWithRuinOrEncampment = unit.viewableTiles
.firstOrNull {
(
(it.improvement != null && it.getTileImprovement()!!.isAncientRuinsEquivalent())
|| it.improvement == Constants.barbarianEncampment
)
(it.getTileImprovement()?.isAncientRuinsEquivalent() == true
|| it.improvement == Constants.barbarianEncampment)
&& unit.movement.canMoveTo(it) && unit.movement.canReach(it)
} ?: return false
unit.movement.headTowards(tileWithRuinOrEncampment)
Expand Down

0 comments on commit d164f7b

Please sign in to comment.