v0.4.3a: fixed an infinite loop in levelgen caused by the wandmaker

This commit is contained in:
Evan Debenham 2016-10-20 02:46:57 -04:00
parent e065d68f71
commit 0af0fec634

View File

@ -262,7 +262,9 @@ public class Wandmaker extends NPC {
Wandmaker npc = new Wandmaker(); Wandmaker npc = new Wandmaker();
do { do {
npc.pos = level.pointToCell(room.random()); npc.pos = level.pointToCell(room.random());
} while (level.map[npc.pos] == Terrain.ENTRANCE || level.map[npc.pos] == Terrain.SIGN); //Wandmaker must never spawn in the center.
//If he does, and the room is 3x3, there is no room for the stairs.
} while (npc.pos == level.pointToCell(room.center()));
level.mobs.add( npc ); level.mobs.add( npc );
spawned = true; spawned = true;