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(); }