Mercurial > rinkhals
comparison gamelib/gameboard.py @ 561:7f037ee2a6c8
Show count of selected chickens in buildings
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 28 Nov 2009 18:40:04 +0000 |
parents | 50d6c68ce267 |
children | 32b6b66e114a |
comparison
equal
deleted
inserted
replaced
560:8cd13b82585e | 561:7f037ee2a6c8 |
---|---|
482 return True | 482 return True |
483 return False # safe move | 483 return False # safe move |
484 | 484 |
485 def select_animal(self, animal): | 485 def select_animal(self, animal): |
486 self.selected_chickens.append(animal) | 486 self.selected_chickens.append(animal) |
487 if animal.abode: | |
488 animal.abode.building.update_occupant_count() | |
487 animal.equip(equipment.Spotlight()) | 489 animal.equip(equipment.Spotlight()) |
488 | 490 |
489 def unselect_all(self): | 491 def unselect_all(self): |
490 # Clear any highlights | 492 # Clear any highlights |
491 for chick in self.selected_chickens: | 493 old_sel = self.selected_chickens |
494 self.selected_chickens = [] | |
495 for chick in old_sel: | |
492 chick.unequip_by_name("Spotlight") | 496 chick.unequip_by_name("Spotlight") |
493 self.selected_chickens = [] | 497 if chick.abode: |
498 chick.abode.building.update_occupant_count() | |
494 | 499 |
495 def unselect_animal(self, animal): | 500 def unselect_animal(self, animal): |
496 if animal in self.selected_chickens: | 501 if animal in self.selected_chickens: |
497 self.selected_chickens.remove(animal) | 502 self.selected_chickens.remove(animal) |
498 animal.unequip_by_name("Spotlight") | 503 animal.unequip_by_name("Spotlight") |
504 if animal.abode: | |
505 animal.abode.building.update_occupant_count() | |
499 | 506 |
500 def get_chicken_at_pos(self, tile_pos): | 507 def get_chicken_at_pos(self, tile_pos): |
501 chicken = self.get_outside_chicken(tile_pos) | 508 chicken = self.get_outside_chicken(tile_pos) |
502 if chicken: | 509 if chicken: |
503 return chicken | 510 return chicken |