v0.9.2: fixed rare cases where retreating character would fail to run

This commit is contained in:
Evan Debenham
2021-02-21 16:56:43 -05:00
parent 868b6d6995
commit 44b80b24a9

View File

@@ -857,16 +857,15 @@ public class Dungeon {
BArray.and( passable, Dungeon.level.openSpace, passable );
}
if (chars) {
for (Char c : Actor.chars()) {
if (visible[c.pos]) {
passable[c.pos] = false;
}
}
}
passable[ch.pos] = true;
return PathFinder.getStepBack( ch.pos, from, passable );
//only consider chars impassable if our retreat path runs into them
int step = PathFinder.getStepBack( ch.pos, from, passable );
while (step != -1 && Actor.findChar(step) != null){
passable[step] = false;
step = PathFinder.getStepBack( ch.pos, from, passable );
}
return step;
}