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 = 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 =

View File

@ -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)
} }
} }

View File

@ -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

View File

@ -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()) {