Solve self-introduced bug in unit movement. Thank G-d (literaly) for ConsoleLauncher, may his name (G-d's) be blessed

This commit is contained in:
yairm210 2024-09-16 04:29:25 +03:00
parent c3d579b278
commit 0e612ac574

View File

@ -44,7 +44,8 @@ class UnitMovement(val unit: MapUnit) {
// If I can't move my only option is to stay...
if (unitMovement == 0f || unit.cache.cannotMove) return distanceToTiles
// If our escort can't move, ditto
if (includeOtherEscortUnit && unit.getOtherEscortUnit()?.currentMovement == 0f) return distanceToTiles
if (includeOtherEscortUnit && unit.isEscorting()
&& unit.getOtherEscortUnit()?.currentMovement == 0f) return distanceToTiles
var tilesToCheck = listOf(unitTile)
@ -703,10 +704,10 @@ class UnitMovement(val unit: MapUnit) {
movementCostCache: HashMap<Pair<Tile, Tile>, Float> = HashMap(),
includeOtherEscortUnit: Boolean = true
): PathsToTilesWithinTurn {
val cacheResults = pathfindingCache.getDistanceToTiles(considerZoneOfControl)
if (cacheResults != null) {
return cacheResults
}
// val cacheResults = pathfindingCache.getDistanceToTiles(considerZoneOfControl)
// if (cacheResults != null) {
// return cacheResults
// }
val distanceToTiles = getDistanceToTilesAtPosition(
unit.currentTile.position,
unit.currentMovement,