Ignore:
Timestamp:
Sep 4, 2009, 7:51:19 PM (11 years ago)
Author:
Adrianna Pińska <adrianna.pinska@…>
Branch:
default
Convert:
svn:b4e93282-eac8-4b8b-b765-0f5d36de2b68@201
Message:

selected chickens are selected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gamelib/gameboard.py

    r197 r200  
    218218    def set_selected_tool(self, tool, cursor):
    219219        self.selected_tool = tool
    220         self.animal_to_place = None
     220        self.select_animal_to_place(None)
    221221        if cursor:
    222222            pygame.mouse.set_cursor(*cursor)
     
    322322            self.open_building_dialog(building, do_sell)
    323323
     324    def select_animal_to_place(self, animal):
     325        if self.animal_to_place:
     326            self.animal_to_place.unequip_by_name("spotlight")
     327        self.animal_to_place = animal
     328        if self.animal_to_place:
     329            self.animal_to_place.equip(equipment.Spotlight())
     330
    324331    def place_animal(self, tile_pos):
    325332        """Handle an TOOL_PLACE_ANIMALS click.
     
    331338        if chicken:
    332339            if chicken is self.animal_to_place:
    333                 self.animal_to_place = None
     340                self.select_animal_to_place(None)
    334341                pygame.mouse.set_cursor(*cursors.cursors['select'])
    335342            else:
    336                 self.animal_to_place = chicken
     343                self.select_animal_to_place(chicken)
    337344                pygame.mouse.set_cursor(*cursors.cursors['chicken'])
    338345            return
     
    343350                    place = building.first_empty_place()
    344351                    self.relocate_animal(self.animal_to_place, place=place)
    345                     self.animal_to_place = None
     352                    self.select_animal_to_place(None)
    346353                    pygame.mouse.set_cursor(*cursors.cursors['select'])
    347354                except buildings.BuildingFullError:
     
    401408            # sell_callback should return true if we need to remove the
    402409            # occupant
    403             self.animal_to_place = place.occupant
     410            self.select_animal_to_place(place.occupant)
    404411            if not sell_callback:
    405412                pygame.mouse.set_cursor(*cursors.cursors['chicken'])
    406413            else:
    407414                # Attempt to sell the occupant
    408                 self.animal_to_place = None
     415                self.select_animal_to_place(None)
    409416                if sell_callback(place.occupant):
    410417                    button.value = icons.EMPTY_NEST_ICON
Note: See TracChangeset for help on using the changeset viewer.