From 735515df65a693f4dae7acb44a40a3e0448af0d9 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 24 Oct 2023 11:55:15 -0400 Subject: [PATCH] v2.2.1: fixed level load failsafe logic wrongly triggering in new quest --- .../com/shatteredpixel/shatteredpixeldungeon/Dungeon.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index a2dea3589..ecf9cf309 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -448,13 +448,17 @@ public class Dungeon { } public static void switchLevel( final Level level, int pos ) { - + + //Position of -2 specifically means trying to place the hero the exit if (pos == -2){ LevelTransition t = level.getTransition(LevelTransition.Type.REGULAR_EXIT); if (t != null) pos = t.cell(); } - if (pos < 0 || pos >= level.length() || (!level.passable[pos] && !level.avoid[pos])){ + //Place hero at the entrance if they are out of the map (often used for pox = -1) + // or if they are in solid terrain (except in the mining level, where that happens normally) + if (pos < 0 || pos >= level.length() + || (!(level instanceof MiningLevel) && !level.passable[pos] && !level.avoid[pos])){ pos = level.getTransition(null).cell(); }