Mercurial > rinkhals
diff gamelib/gameboard.py @ 224:c279ad59b8e2
Chicks fill hen house, then adjacent spaces, then die.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Fri, 04 Sep 2009 22:59:14 +0000 |
parents | 527a5d4e3fa3 |
children | 97a22d0b0471 |
line wrap: on
line diff
--- a/gamelib/gameboard.py Fri Sep 04 22:39:19 2009 +0000 +++ b/gamelib/gameboard.py Fri Sep 04 22:59:14 2009 +0000 @@ -712,10 +712,17 @@ self.add_chicken(new_chick) new_chick.equip(equipment.Nest()) except buildings.BuildingFullError: + # No space in the hen house, look nearby + for tile_pos in building.adjacent_tiles(): + if self.tv.get(tile_pos) != self.GRASSLAND: + continue + if self.get_outside_chicken(tile_pos) is None: + self.add_chicken(new_chick) + self.relocate_animal(new_chick, tile_pos=tile_pos) + break # if there isn't a space for the # new chick it dies. :/ Farm life # is cruel. - pass self.toolbar.update_egg_counter(self.eggs) def kill_fox(self, fox):