diff gamelib/gameboard.py @ 213:07b361ebd87f

Ensure we clean up highlights, etc.
author Neil Muller <drnlmuller@gmail.com>
date Fri, 04 Sep 2009 21:49:32 +0000
parents b999abd5993b
children 85a5299caf4a
line wrap: on
line diff
--- a/gamelib/gameboard.py	Fri Sep 04 21:35:40 2009 +0000
+++ b/gamelib/gameboard.py	Fri Sep 04 21:49:32 2009 +0000
@@ -249,6 +249,9 @@
 
     def set_selected_tool(self, tool, cursor):
         self.selected_tool = tool
+        if self.animal_to_place:
+            # Clear any highlights
+            self.animal_to_place.unequip_by_name("spotlight")
         self.select_animal_to_place(None)
         sprite_curs = None
         if buildings.is_building(tool):
@@ -266,7 +269,12 @@
         if sprite_curs:
             self.sprite_cursor = sprite_curs
             self.tv.sprites.append(self.sprite_cursor)
-            
+
+    def reset_states(self):
+        """Clear current states (highlights, etc.)"""
+        if self.animal_to_place:
+            self.animal_to_place.unequip_by_name("spotlight")
+        self.set_cursor()
 
     def update_sprite_cursor(self, e):
         tile_pos = self.tv.screen_to_tile(e.pos)