changeset 443:4efe57fcc1d7

Anything off the board is invisible.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 21 Nov 2009 18:59:23 +0000
parents 67b32a26dc57
children feb9b7a23ef2
files gamelib/animal.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/animal.py	Sat Nov 21 18:56:59 2009 +0000
+++ b/gamelib/animal.py	Sat Nov 21 18:59:23 2009 +0000
@@ -665,6 +665,9 @@
     return param
 
 def visible(watcher, watchee, gameboard):
+    if not gameboard.in_bounds(watchee.pos):
+        # We can't see anything off the edge of the board.
+        return False
     vision_bonus = _get_vision_param('VISION_BONUS', watcher)
     range_penalty = _get_vision_param('VISION_RANGE_PENALTY', watcher)
     positions = watcher.pos.intermediate_positions(watchee.pos)