Changeset 144:a9b800b4175e


Ignore:
Timestamp:
Sep 3, 2009, 2:59:13 PM (11 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Convert:
svn:b4e93282-eac8-4b8b-b765-0f5d36de2b68@145
Message:

Add define for henhouses & egg laying.

Location:
gamelib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gamelib/buildings.py

    r136 r144  
    201201    return getattr(obj, "IS_BUILDING", False) and hasattr(obj, "NAME")
    202202
     203# Building hens can lay eggs in
     204HENHOUSES = [HenHouse.NAME, DoubleStoryHenHouse.NAME]
     205
    203206BUILDINGS = []
    204207for name in dir():
  • gamelib/gameboard.py

    r139 r144  
    448448        self.eggs = 0
    449449        for building in self.buildings:
    450             if building.NAME in [buildings.HenHouse.NAME]:
     450            if building.NAME in buildings.HENHOUSES:
    451451                for chicken in building.occupants():
    452452                    chicken.lay()
     
    457457    def hatch_eggs(self):
    458458        for building in self.buildings:
    459             if building.NAME in [buildings.HenHouse.NAME]:
     459            if building.NAME in buildings.HENHOUSES:
    460460                for chicken in building.occupants():
    461461                    new_chick = chicken.hatch()
     
    489489            chick.abode.clear_occupant()
    490490        self.toolbar.update_chicken_counter(len(self.chickens))
    491         if chick in self.tv.sprites:
    492             if chick.outside():
    493                 self.tv.sprites.remove(chick)
     491        if chick in self.tv.sprites and chick.outside():
     492            self.tv.sprites.remove(chick)
    494493
    495494    def remove_building(self, building):
Note: See TracChangeset for help on using the changeset viewer.