diff gamelib/buildings.py @ 439:cf4b020e6385

Start of serializer for buildings and support for reference cycles.
author Simon Cross <hodgestar@gmail.com>
date Sat, 21 Nov 2009 18:34:36 +0000
parents 95b81e917399
children e945c4186ee5
line wrap: on
line diff
--- a/gamelib/buildings.py	Sat Nov 21 18:15:01 2009 +0000
+++ b/gamelib/buildings.py	Sat Nov 21 18:34:36 2009 +0000
@@ -13,9 +13,15 @@
 import warnings
 warnings.filterwarnings("ignore", "os.popen3 is deprecated.")
 
-class Place(object):
+class Place(serializer.Simplifiable):
     """Space within a building that can be occupied."""
 
+    SIMPLIFY = [
+        'occupant',
+        'building',
+        'offset',
+    ]
+
     def __init__(self, building, offset):
         self.occupant = None
         self.building = building
@@ -40,11 +46,16 @@
         return (bpos[0] + self.offset[0], bpos[1] + self.offset[1],
                 self.offset[2])
 
-class Floor(object):
+class Floor(serializer.Simplifiable):
     """A set of places within a building. Places on a
        floor are organised into rows and columns.
        """
 
+    SIMPLIFY = [
+        'title',
+        'places',
+    ]
+
     def __init__(self, title, places):
         self.title = title # str
         self.places = places # list of lists of places
@@ -81,7 +92,7 @@
         '_repair_price',
         '_sun_on',
         '_broken',
-        '_predators',
+        '_floors',
     ]
 
     def __init__(self, pos):