# HG changeset patch # User Simon Cross # Date 1252088237 0 # Node ID 3c80f49d7d7411e24f53511cb5426507bdb77b01 # Parent c5ec3ff32d1168a9d6ab25e20cf5f6e030cee3e2 Don't allow buildings and fences to be built on top of chickens. diff -r c5ec3ff32d11 -r 3c80f49d7d74 gamelib/gameboard.py --- a/gamelib/gameboard.py Fri Sep 04 18:09:37 2009 +0000 +++ b/gamelib/gameboard.py Fri Sep 04 18:17:17 2009 +0000 @@ -413,6 +413,9 @@ cost = constants.BUY_PRICE_FENCE else: cost = constants.REPAIR_PRICE_FENCE + if any((chicken.pos.x, chicken.pos.y) == tile_pos for chicken in self.chickens): + return + if self.cash < cost: print "You can't afford a fence." return @@ -437,6 +440,8 @@ building = building_cls(tile_pos) if self.cash < building.buy_price(): return + if any(building.covers((chicken.pos.x, chicken.pos.y)) for chicken in self.chickens): + return if building.place(self.tv): self.add_cash(-building.buy_price()) self.add_building(building)