v0.6.2: Added proper error handling to a rare case in levelgen
This commit is contained in:
parent
c501b82997
commit
595abdd2c6
|
@ -22,6 +22,7 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
|
package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Patch;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Patch;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
|
@ -144,6 +145,13 @@ public abstract class RegularPainter extends Painter {
|
||||||
if (r.canConnect(p) && n.canConnect(p))
|
if (r.canConnect(p) && n.canConnect(p))
|
||||||
doorSpots.add(p);
|
doorSpots.add(p);
|
||||||
}
|
}
|
||||||
|
if (doorSpots.isEmpty()){
|
||||||
|
ShatteredPixelDungeon.reportException(
|
||||||
|
new RuntimeException("Could not place a door! " +
|
||||||
|
"r=" + r.getClass().getSimpleName() +
|
||||||
|
" n=" + n.getClass().getSimpleName()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
door = new Room.Door(Random.element(doorSpots));
|
door = new Room.Door(Random.element(doorSpots));
|
||||||
|
|
||||||
r.connected.put( n, door );
|
r.connected.put( n, door );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user