v2.2.1: fixed level load failsafe logic wrongly triggering in new quest

This commit is contained in:
Evan Debenham
2023-10-24 11:55:15 -04:00
parent 37a4dc6361
commit 735515df65

View File

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