v0.8.0b: various fixes for levelgen freezing:

- Wandmaker rarely not having a place to go in a 3*3 room with 4 doors
- Nowhere to place the hero if they fall from a chasm into a boss floor
This commit is contained in:
Evan Debenham 2020-05-05 12:16:42 -04:00
parent 55340817e8
commit 9912c5e1ee
2 changed files with 3 additions and 4 deletions

View File

@ -278,7 +278,7 @@ public class Wandmaker extends NPC {
Wandmaker npc = new Wandmaker();
boolean validPos;
//Do not spawn wandmaker on the entrance, or next to a door.
//Do not spawn wandmaker on the entrance, or in front of a door.
do {
validPos = true;
npc.pos = level.pointToCell(room.random());
@ -286,7 +286,7 @@ public class Wandmaker extends NPC {
validPos = false;
}
for (Point door : room.connected.values()){
if (level.adjacent( npc.pos, level.pointToCell( door ) )){
if (level.trueDistance( npc.pos, level.pointToCell( door ) ) <= 1){
validPos = false;
}
}

View File

@ -863,8 +863,7 @@ public abstract class Level implements Bundlable {
do {
result = randomRespawnCell( null );
} while (traps.get(result) != null
|| findMob(result) != null
|| heaps.get(result) != null);
|| findMob(result) != null);
return result;
}