Skip to content

Commit

Permalink
fix: (81, 29) on EverDreamLE is considered in map bounds even though …
Browse files Browse the repository at this point in the history
…it is not

Closes #76
  • Loading branch information
eladyaniv01 committed Sep 6, 2020
1 parent 99ad04d commit 63b91f5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion MapAnalyzer/Pather.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def pathfind(self, start: Tuple[int, int], goal: Tuple[int, int], grid: Optional
self.map_data.logger.warning(PatherNoPointsException(start=start, goal=goal))
return None
if grid is None:
self.map_data.logger.warning("Using the default pyastar grid as no grid was provided.")
grid = self.get_pyastar_grid()

# inbounds steps - convert list of coords to np array , then do grid[[*converted.T]] = val
Expand All @@ -142,7 +143,17 @@ def pathfind(self, start: Tuple[int, int], goal: Tuple[int, int], grid: Optional
for point in path , if point is not in bounds - remove it
"""
path = list(map(Point2, path))[::sensitivity]
legal_path = [point for point in path if point] # removing points that are out of bounds
# removing points that are out of bounds

"""
Edge case
EverDreamLE, (81, 29) is considered in map bounds, but it is not.
"""
if 'everdream' in self.map_data.map_name.lower():
legal_path = [point for point in path if point and point.x != 81 and point.y != 29]
else: # normal case
legal_path = [point for point in path if point]

return legal_path
else:
self.map_data.logger.debug(f"No Path found s{start}, g{goal}")
Expand Down

0 comments on commit 63b91f5

Please sign in to comment.