changeset 530:c1f14fa35d30

Avoid buglet where sprite isn't properly removed for a safe fox
author Neil Muller <drnlmuller@gmail.com>
date Fri, 27 Nov 2009 21:13:43 +0000
parents 93eab01a1e57
children 452cde9af2a2
files gamelib/gameboard.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/gameboard.py	Fri Nov 27 20:44:39 2009 +0000
+++ b/gamelib/gameboard.py	Fri Nov 27 21:13:43 2009 +0000
@@ -913,12 +913,15 @@
 
     def foxes_move(self):
         over = True
-        for fox in self.foxes:
+        for fox in self.foxes.copy():
             old_pos = fox.pos
             fox.move()
             if not fox.safe:
                 over = False
-            self._pos_cache.update(old_pos, fox, 'fox')
+                self._pos_cache.update(old_pos, fox, 'fox')
+            else:
+                # Avoid stale fox on board edge
+                self.remove_fox(fox)
         return over
 
     def foxes_attack(self):