diff gamelib/gameboard.py @ 557:50d6c68ce267

Add gameboard to buildings. Update save version as this breaks old save games
author Neil Muller <drnlmuller@gmail.com>
date Sat, 28 Nov 2009 18:20:46 +0000
parents 46f6f1a98f3f
children 7f037ee2a6c8
line wrap: on
line diff
--- a/gamelib/gameboard.py	Sat Nov 28 18:04:28 2009 +0000
+++ b/gamelib/gameboard.py	Sat Nov 28 18:20:46 2009 +0000
@@ -755,12 +755,12 @@
         self.open_dialog(tbl, close_callback=close_callback)
 
     def buy_building(self, tile_pos, building_cls):
-        building = building_cls(tile_pos)
+        building = building_cls(tile_pos, self)
         if self.wood < 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):
+        if building.place():
             self.add_wood(-building.buy_price())
             self.add_building(building)
 
@@ -802,7 +802,7 @@
             self.open_dialog(warning)
             return
         self.add_wood(building.sell_price())
-        building.remove(self.tv)
+        building.remove()
         self.remove_building(building)
 
     def repair_building(self, tile_pos):
@@ -812,7 +812,7 @@
         if self.wood < building.repair_price():
             return
         self.add_wood(-building.repair_price())
-        building.repair(self.tv)
+        building.repair()
 
     def sell_equipment(self, tile_pos):
         x, y = 0, 0
@@ -1150,9 +1150,9 @@
                     continue
 
                 building_cls = tile_to_building[tile_no]
-                building = building_cls(tile_pos)
-                building.remove(self.tv)
-                building.place(self.tv)
+                building = building_cls(tile_pos, self)
+                building.remove()
+                building.place()
                 self.add_building(building)
 
     def trees_left(self):