Merge branch 'fix-mobs-vision-bug' into 'master'

Resolve "Fix mobs vision bug"

Closes #71

See merge request ynerant/squirrel-battle!69
This commit is contained in:
nicomarg 2021-01-10 19:48:01 +01:00
commit 2efa9d4575
1 changed files with 2 additions and 0 deletions

View File

@ -197,9 +197,11 @@ class Map:
def is_visible_from(self, starty: int, startx: int, desty: int, destx: int, def is_visible_from(self, starty: int, startx: int, desty: int, destx: int,
max_range: int) -> bool: max_range: int) -> bool:
oldvisibility = deepcopy(self.visibility) oldvisibility = deepcopy(self.visibility)
oldseen = deepcopy(self.seen_tiles)
self.compute_visibility(starty, startx, max_range) self.compute_visibility(starty, startx, max_range)
result = self.visibility[desty][destx] result = self.visibility[desty][destx]
self.visibility = oldvisibility self.visibility = oldvisibility
self.seen_tiles = oldseen
return result return result
def compute_visibility(self, y: int, x: int, max_range: int) -> None: def compute_visibility(self, y: int, x: int, max_range: int) -> None: