Skip to content

Commit 8260e55

Browse files
committed
update and document bresenham
1 parent a23c722 commit 8260e55

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tdl/map.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,12 @@ def quick_fov(x, y, callback, fov='PERMISSIVE', radius=7.5, lightWalls=True, sph
205205

206206
def bresenham(x1, y1, x2, y2):
207207
"""
208-
Iterate over points in a bresenham line.
208+
Return a list of points in a bresenham line.
209209
210210
Implementation hastily copied from RogueBasin.
211211
212-
@return: Returns an iterator of (x, y) points.
212+
@return: Returns a list of (x, y) points, including both the start and
213+
endpoints.
213214
"""
214215
points = []
215216
issteep = abs(y2-y1) > abs(x2-x1)
@@ -242,7 +243,7 @@ def bresenham(x1, y1, x2, y2):
242243
# Reverse the list if the coordinates were reversed
243244
if rev:
244245
points.reverse()
245-
return iter(points) # force as iter so I can sleep at night
246+
return points
246247

247248
__all__ = [_var for _var in locals().keys() if _var[0] != '_']
248249

0 commit comments

Comments
 (0)