Fixed broken tests due to 'impassible' changes

This commit is contained in:
Yair Morgenstern
2020-06-28 20:48:51 +03:00
parent 18b2c5868b
commit 79ff8c2ecf
4 changed files with 12 additions and 5 deletions

View File

@ -560,6 +560,7 @@ Load game =
Main menu =
Resume =
Cannot resume game! =
Not enough memory on phone to load game! =
Quickstart =
Victory status =
Social policies =

View File

@ -155,7 +155,11 @@ class MainMenuScreen: CameraStageBaseScreen() {
private fun autoLoadGame() {
try {
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)
}
}

View File

@ -327,15 +327,17 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
// so multiple callees of this function have been optimized,
// because optimization on this function results in massive benefits!
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
&& unit.type.isWaterUnit()
// Check that the tile is not a coastal city's center
&& !(tile.isCityCenter() && tile.isCoastalTile()))
return false
if (tile.terrainFeature == Constants.ice && !unit.canEnterIceTiles)
return false
if (tile.isWater && unit.type.isLandUnit()) {
if (!unit.civInfo.tech.unitsCanEmbark) return false

View File

@ -116,7 +116,7 @@ class UnitMovementAlgorithmsTests {
@Test
fun canNOTEnterNaturalWonder() {
tile.baseTerrain = Constants.plains
tile.naturalWonder = "Wonder Thunder"
tile.naturalWonder = "Mount Fuji"
tile.setTransients()
for (type in UnitType.values()) {