Mercurial > rinkhals
changeset 227:b9782f622006
Allow selling of broken fences.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Fri, 04 Sep 2009 23:26:25 +0000 |
parents | 86a6d9e360dd |
children | f74de4280e20 |
files | gamelib/constants.py gamelib/gameboard.py |
diffstat | 2 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/gamelib/constants.py Fri Sep 04 23:20:40 2009 +0000 +++ b/gamelib/constants.py Fri Sep 04 23:26:25 2009 +0000 @@ -34,6 +34,7 @@ BUY_PRICE_FENCE = 50 SELL_PRICE_FENCE = 25 REPAIR_PRICE_FENCE = 25 +SELL_PRICE_BROKEN_FENCE = 5 TOOL_SELL_CHICKEN = 1 TOOL_SELL_EGG = 2
--- a/gamelib/gameboard.py Fri Sep 04 23:20:40 2009 +0000 +++ b/gamelib/gameboard.py Fri Sep 04 23:26:25 2009 +0000 @@ -552,9 +552,13 @@ self.tv.set(tile_pos, self.FENCE) def sell_fence(self, tile_pos): - if self.tv.get(tile_pos) != self.FENCE: + this_tile = self.tv.get(tile_pos) + if this_tile not in [self.FENCE, self.BROKEN_FENCE]: return - self.add_cash(constants.SELL_PRICE_FENCE) + if this_tile == self.FENCE: + self.add_cash(constants.SELL_PRICE_FENCE) + elif this_tile == self.BROKEN_FENCE: + self.add_cash(constants.SELL_PRICE_BROKEN_FENCE) self.tv.set(tile_pos, self.GRASSLAND) def logging_forest(self, tile_pos): @@ -585,7 +589,7 @@ chicken.equip(equipment) def sell_building(self, tile_pos): - if self.tv.get(tile_pos) == self.FENCE: + if self.tv.get(tile_pos) in [self.FENCE, self.BROKEN_FENCE]: return self.sell_fence(tile_pos) building = self.get_building(tile_pos) if building is None: