v0.6.0: fixed crashes relating to random cell logic on floor 25

This commit is contained in:
Evan Debenham 2017-04-25 14:38:52 -04:00
parent 6bac24ac89
commit 73aed6726c

View File

@ -167,10 +167,10 @@ public class HallsBossLevel extends Level {
@Override
public int randomRespawnCell() {
if (entrance == -1) return entrance;
int cell = entrance + PathFinder.NEIGHBOURS8[Random.Int(8)];
int pos = entrance == -1 ? stairs : entrance;
int cell = pos + PathFinder.NEIGHBOURS8[Random.Int(8)];
while (!passable[cell]){
cell = entrance + PathFinder.NEIGHBOURS8[Random.Int(8)];
cell = pos + PathFinder.NEIGHBOURS8[Random.Int(8)];
}
return cell;
}