v0.9.1: fixed crashes with rockfall traps

This commit is contained in:
Evan Debenham 2020-12-02 18:11:55 -05:00
parent e3523a2a07
commit 74679f153e

View File

@ -58,9 +58,12 @@ public class RockfallTrap extends Trap {
//determines if the trap is actually in the world, or if it is being spawned for its effect
boolean onGround = Dungeon.level.traps.get(pos) == this;
Room r = null;
if (Dungeon.level instanceof RegularLevel){
r = ((RegularLevel) Dungeon.level).room(pos);
}
if (onGround && Dungeon.level instanceof RegularLevel){
Room r = ((RegularLevel) Dungeon.level).room(pos);
if (onGround && r != null){
int cell;
for (Point p : r.getPoints()){
cell = Dungeon.level.pointToCell(p);
@ -69,7 +72,7 @@ public class RockfallTrap extends Trap {
}
}
//if we don't have rooms, then just do 5x5
//if we don't have a room, then just do 5x5
} else {
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
for (int i = 0; i < PathFinder.distance.length; i++) {