mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 05:14:32 -04:00
Resolved #6164 - transported units reveal tiles as if they passed through the path of the transporting unit
This commit is contained in:
parent
1e44b1a235
commit
48bbed9fad
@ -403,7 +403,6 @@ class MapUnit {
|
||||
viewableTiles = if (hasUnique(UniqueType.SixTilesAlwaysVisible))
|
||||
getTile().getTilesInDistance(6).toHashSet() // it's that simple
|
||||
else HashSet(0) // bomber units don't do recon
|
||||
return
|
||||
} else {
|
||||
viewableTiles = getTile().getViewableTilesList(getVisibilityRange()).toHashSet()
|
||||
}
|
||||
|
@ -485,6 +485,8 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
val finalTileReached = lastReachedEnterableTile
|
||||
|
||||
// Silly floats which are almost zero
|
||||
if (unit.currentMovement < Constants.minimumMovementEpsilon)
|
||||
@ -492,20 +494,24 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||
|
||||
|
||||
if (!unit.isDestroyed)
|
||||
unit.putInTile(lastReachedEnterableTile)
|
||||
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
|
||||
for (payload in origin.getUnits().filter { it.isTransported && unit.canTransport(it) }.toList()) { // bring along the payloads
|
||||
payload.removeFromTile()
|
||||
payload.putInTile(lastReachableTile)
|
||||
for (tile in pathToLastReachableTile){
|
||||
payload.moveThroughTile(tile)
|
||||
if (tile == finalTileReached) break // this is the final tile the transport reached
|
||||
}
|
||||
payload.putInTile(finalTileReached)
|
||||
payload.isTransported = true // restore the flag to not leave the payload in the cit
|
||||
payload.mostRecentMoveType = UnitMovementMemoryType.UnitMoved
|
||||
}
|
||||
|
||||
// Unit maintenance changed
|
||||
if (unit.canGarrison()
|
||||
&& (origin.isCityCenter() || lastReachableTile.isCityCenter())
|
||||
&& (origin.isCityCenter() || finalTileReached.isCityCenter())
|
||||
&& unit.civInfo.hasUnique(UniqueType.UnitsInCitiesNoMaintenance)
|
||||
) unit.civInfo.updateStatsForNextTurn()
|
||||
if (needToFindNewRoute) moveToTile(destination, considerZoneOfControl)
|
||||
|
Loading…
x
Reference in New Issue
Block a user