mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 09:18:43 +07:00
Fixed broken tests due to 'impassible' changes
This commit is contained in:
@ -560,6 +560,7 @@ Load game =
|
|||||||
Main menu =
|
Main menu =
|
||||||
Resume =
|
Resume =
|
||||||
Cannot resume game! =
|
Cannot resume game! =
|
||||||
|
Not enough memory on phone to load game! =
|
||||||
Quickstart =
|
Quickstart =
|
||||||
Victory status =
|
Victory status =
|
||||||
Social policies =
|
Social policies =
|
||||||
|
@ -155,7 +155,11 @@ class MainMenuScreen: CameraStageBaseScreen() {
|
|||||||
private fun autoLoadGame() {
|
private fun autoLoadGame() {
|
||||||
try {
|
try {
|
||||||
game.loadGame(autosave)
|
game.loadGame(autosave)
|
||||||
} catch (ex: Exception) { // silent fail if we can't read the autosave
|
}
|
||||||
|
catch (outOfMemory:OutOfMemoryError){
|
||||||
|
ResponsePopup("Not enough memory on phone to load game!", this)
|
||||||
|
}
|
||||||
|
catch (ex: Exception) { // silent fail if we can't read the autosave
|
||||||
ResponsePopup("Cannot resume game!", this)
|
ResponsePopup("Cannot resume game!", this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,15 +327,17 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
|||||||
// so multiple callees of this function have been optimized,
|
// so multiple callees of this function have been optimized,
|
||||||
// because optimization on this function results in massive benefits!
|
// because optimization on this function results in massive benefits!
|
||||||
fun canPassThrough(tile: TileInfo): Boolean {
|
fun canPassThrough(tile: TileInfo): Boolean {
|
||||||
if (tile.isImpassible()) return false
|
if (tile.isImpassible()){
|
||||||
|
// special exception - ice tiles are technically impassible, but somme units can move through them anyway
|
||||||
|
if (!(tile.terrainFeature == Constants.ice && unit.canEnterIceTiles))
|
||||||
|
return false
|
||||||
|
}
|
||||||
if (tile.isLand
|
if (tile.isLand
|
||||||
&& unit.type.isWaterUnit()
|
&& unit.type.isWaterUnit()
|
||||||
// Check that the tile is not a coastal city's center
|
// Check that the tile is not a coastal city's center
|
||||||
&& !(tile.isCityCenter() && tile.isCoastalTile()))
|
&& !(tile.isCityCenter() && tile.isCoastalTile()))
|
||||||
return false
|
return false
|
||||||
|
|
||||||
if (tile.terrainFeature == Constants.ice && !unit.canEnterIceTiles)
|
|
||||||
return false
|
|
||||||
|
|
||||||
if (tile.isWater && unit.type.isLandUnit()) {
|
if (tile.isWater && unit.type.isLandUnit()) {
|
||||||
if (!unit.civInfo.tech.unitsCanEmbark) return false
|
if (!unit.civInfo.tech.unitsCanEmbark) return false
|
||||||
|
@ -116,7 +116,7 @@ class UnitMovementAlgorithmsTests {
|
|||||||
@Test
|
@Test
|
||||||
fun canNOTEnterNaturalWonder() {
|
fun canNOTEnterNaturalWonder() {
|
||||||
tile.baseTerrain = Constants.plains
|
tile.baseTerrain = Constants.plains
|
||||||
tile.naturalWonder = "Wonder Thunder"
|
tile.naturalWonder = "Mount Fuji"
|
||||||
tile.setTransients()
|
tile.setTransients()
|
||||||
|
|
||||||
for (type in UnitType.values()) {
|
for (type in UnitType.values()) {
|
||||||
|
Reference in New Issue
Block a user