Fixed a bug when trying to pathfind when player is surrounded by inaccessible tiles
This commit is contained in:
parent
cc6033e8e4
commit
01cc77e146
|
@ -136,7 +136,8 @@ class Player(FightingEntity):
|
||||||
# iterable, and we associate the points to their distance, sort
|
# iterable, and we associate the points to their distance, sort
|
||||||
# along the distance, then only keep the points.
|
# along the distance, then only keep the points.
|
||||||
self.paths = {}
|
self.paths = {}
|
||||||
for y, x in reduce(set.union, [set(p.keys()) for p in predecessors]):
|
for y, x in reduce(set.union,
|
||||||
|
[set(p.keys()) for p in predecessors], set()):
|
||||||
self.paths[(y, x)] = [p for d, p in sorted(
|
self.paths[(y, x)] = [p for d, p in sorted(
|
||||||
[(distances[i][(y, x)], predecessors[i][(y, x)])
|
[(distances[i][(y, x)], predecessors[i][(y, x)])
|
||||||
for i in range(len(distances)) if (y, x) in predecessors[i]])]
|
for i in range(len(distances)) if (y, x) in predecessors[i]])]
|
||||||
|
|
Loading…
Reference in New Issue