changeset 77:65958516c7d9

Implement separate fence repair cost (currently 25 groats).
author Simon Cross <hodgestar@gmail.com>
date Tue, 01 Sep 2009 10:40:57 +0000
parents 615a5afaf1a4
children 7d043a210121
files gamelib/constants.py gamelib/gameboard.py
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/constants.py	Tue Sep 01 10:15:21 2009 +0000
+++ b/gamelib/constants.py	Tue Sep 01 10:40:57 2009 +0000
@@ -23,6 +23,7 @@
 SELL_PRICE_CHICKEN = 10
 BUY_PRICE_FENCE = 50
 SELL_PRICE_FENCE = 25
+REPAIR_PRICE_FENCE = 25
 
 TOOL_SELL_CHICKEN = 1
 TOOL_SELL_EGG = 2
--- a/gamelib/gameboard.py	Tue Sep 01 10:15:21 2009 +0000
+++ b/gamelib/gameboard.py	Tue Sep 01 10:40:57 2009 +0000
@@ -174,10 +174,14 @@
         this_tile = self.tv.get(tile_pos)
         if this_tile not in [self.GRASSLAND, self.BROKEN_FENCE]:
             return
-        if self.cash < constants.BUY_PRICE_FENCE:
+        if this_tile == self.GRASSLAND:
+            cost = constants.BUY_PRICE_FENCE
+        else:
+            cost = constants.REPAIR_PRICE_FENCE
+        if self.cash < cost:
             print "You can't afford a fence."
             return
-        self.add_cash(-constants.BUY_PRICE_FENCE)
+        self.add_cash(-cost)
         self.tv.set(tile_pos, self.FENCE)
 
     def sell_fence(self, tile_pos):