Mercurial > rinkhals
comparison gamelib/gameboard.py @ 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 |
comparison
equal
deleted
inserted
replaced
226:86a6d9e360dd | 227:b9782f622006 |
---|---|
550 return | 550 return |
551 self.add_cash(-cost) | 551 self.add_cash(-cost) |
552 self.tv.set(tile_pos, self.FENCE) | 552 self.tv.set(tile_pos, self.FENCE) |
553 | 553 |
554 def sell_fence(self, tile_pos): | 554 def sell_fence(self, tile_pos): |
555 if self.tv.get(tile_pos) != self.FENCE: | 555 this_tile = self.tv.get(tile_pos) |
556 return | 556 if this_tile not in [self.FENCE, self.BROKEN_FENCE]: |
557 self.add_cash(constants.SELL_PRICE_FENCE) | 557 return |
558 if this_tile == self.FENCE: | |
559 self.add_cash(constants.SELL_PRICE_FENCE) | |
560 elif this_tile == self.BROKEN_FENCE: | |
561 self.add_cash(constants.SELL_PRICE_BROKEN_FENCE) | |
558 self.tv.set(tile_pos, self.GRASSLAND) | 562 self.tv.set(tile_pos, self.GRASSLAND) |
559 | 563 |
560 def logging_forest(self, tile_pos): | 564 def logging_forest(self, tile_pos): |
561 if self.tv.get(tile_pos) != self.WOODLAND: | 565 if self.tv.get(tile_pos) != self.WOODLAND: |
562 return | 566 return |
583 if equipment.place(chicken): | 587 if equipment.place(chicken): |
584 self.add_cash(-equipment.buy_price()) | 588 self.add_cash(-equipment.buy_price()) |
585 chicken.equip(equipment) | 589 chicken.equip(equipment) |
586 | 590 |
587 def sell_building(self, tile_pos): | 591 def sell_building(self, tile_pos): |
588 if self.tv.get(tile_pos) == self.FENCE: | 592 if self.tv.get(tile_pos) in [self.FENCE, self.BROKEN_FENCE]: |
589 return self.sell_fence(tile_pos) | 593 return self.sell_fence(tile_pos) |
590 building = self.get_building(tile_pos) | 594 building = self.get_building(tile_pos) |
591 if building is None: | 595 if building is None: |
592 return | 596 return |
593 if list(building.occupants()): | 597 if list(building.occupants()): |