comparison gamelib/buildings.py @ 505:3ed6c011106d

Switch to classmethod decorators.
author Simon Cross <hodgestar@gmail.com>
date Thu, 26 Nov 2009 22:34:58 +0000
parents b74b3a37cf1d
children 50d6c68ce267
comparison
equal deleted inserted replaced
504:393e30ea0165 505:3ed6c011106d
128 self.draw_stack = {"main": (0, self.images['fixed']['day'])} 128 self.draw_stack = {"main": (0, self.images['fixed']['day'])}
129 129
130 # Create the building somewhere far off screen 130 # Create the building somewhere far off screen
131 Sprite.__init__(self, self.images['fixed']['day'], (-1000, -1000)) 131 Sprite.__init__(self, self.images['fixed']['day'], (-1000, -1000))
132 132
133 @classmethod
133 def make(cls): 134 def make(cls):
134 """Override default Simplifiable object creation.""" 135 """Override default Simplifiable object creation."""
135 return cls((0, 0)) 136 return cls((0, 0))
136 make = classmethod(make) 137
137 138 @classmethod
138 def unsimplify(cls, *args, **kwargs): 139 def unsimplify(cls, *args, **kwargs):
139 """Override default Simplifiable unsimplification.""" 140 """Override default Simplifiable unsimplification."""
140 obj = super(Building, cls).unsimplify(*args, **kwargs) 141 obj = super(Building, cls).unsimplify(*args, **kwargs)
141 obj._set_main_image() 142 obj._set_main_image()
142 obj.update_occupant_count() 143 obj.update_occupant_count()
143 return obj 144 return obj
144 unsimplify = classmethod(unsimplify)
145 145
146 def _set_images(self): 146 def _set_images(self):
147 self.images = {'fixed': { 147 self.images = {'fixed': {
148 'day': imagecache.load_image(self.IMAGE), 148 'day': imagecache.load_image(self.IMAGE),
149 'night': imagecache.load_image(self.IMAGE, ('night',)), 149 'night': imagecache.load_image(self.IMAGE, ('night',)),