mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 03:23:17 -04:00
RISKY - *actually* move units into tiles along the path - this should solve the "ruins bonus generates units that then block path" as well as giving correct LOS reveals for intermediate tiles when units are escorted
This also makes the code a lot simpler, but may reveal unintended side effects, so we should be on the lookout
This commit is contained in:
parent
8854676d6e
commit
41a124d29e
@ -450,7 +450,6 @@ class UnitMovement(val unit: MapUnit) {
|
||||
needToFindNewRoute = true
|
||||
break // If you ever remove this break, remove the `assumeCanPassThrough` param below
|
||||
}
|
||||
unit.moveThroughTile(tile)
|
||||
|
||||
// This fixes a bug where tiles in the fog of war would always only cost 1 mp
|
||||
if (!unit.civ.gameInfo.gameParameters.godMode)
|
||||
@ -461,6 +460,13 @@ class UnitMovement(val unit: MapUnit) {
|
||||
if (unit.movement.canMoveTo(tile, assumeCanPassThrough = true)) {
|
||||
lastReachedEnterableTile = tile
|
||||
unit.useMovementPoints(passingMovementSpent)
|
||||
unit.putInTile(tile) // Required for ruins,
|
||||
|
||||
if (escortUnit != null) {
|
||||
escortUnit.movement.moveToTile(tile)
|
||||
unit.startEscorting() // Need to re-apply this
|
||||
}
|
||||
|
||||
passingMovementSpent = 0f
|
||||
}
|
||||
|
||||
@ -479,9 +485,6 @@ class UnitMovement(val unit: MapUnit) {
|
||||
unit.currentMovement = 0f
|
||||
|
||||
|
||||
if (!unit.isDestroyed)
|
||||
unit.putInTile(finalTileReached)
|
||||
|
||||
// The .toList() here is because we have a sequence that's running on the units in the tile,
|
||||
// then if we move one of the units we'll get a ConcurrentModificationException, se we save them all to a list
|
||||
val payloadUnits = origin.getUnits().filter { it.isTransported && unit.canTransport(it) }.toList()
|
||||
@ -496,10 +499,6 @@ class UnitMovement(val unit: MapUnit) {
|
||||
payload.isTransported = true // restore the flag to not leave the payload in the city
|
||||
payload.mostRecentMoveType = UnitMovementMemoryType.UnitMoved
|
||||
}
|
||||
if (escortUnit != null) {
|
||||
escortUnit.movement.moveToTile(finalTileReached)
|
||||
unit.startEscorting() // Need to re-apply this
|
||||
}
|
||||
|
||||
// Unit maintenance changed
|
||||
if (unit.canGarrison()
|
||||
|
Loading…
x
Reference in New Issue
Block a user