Mercurial > rinkhals
changeset 407:bdc8bc78a796
Handle corner case aroudn entering the map
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 21 Nov 2009 06:44:19 +0000 |
parents | f8072b2d6dd1 |
children | 02a6de5629d6 |
files | gamelib/animal.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/gamelib/animal.py Fri Nov 20 23:04:38 2009 +0000 +++ b/gamelib/animal.py Sat Nov 21 06:44:19 2009 +0000 @@ -344,7 +344,9 @@ min_dist = dist min_cost = cost best = point - if min_cost < 20: + if min_cost < 20 or not gameboard.in_bounds(self.pos): + # If we're not on the gameboard yet, there's no point in looking + # for an optimal path. return best # Else expensive step, so think further direct_path = self._gen_path(self.pos, final_pos)