diff gamelib/gameboard.py @ 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 f3ce3346e25e
children 8241386a1651
line wrap: on
line diff
--- 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):