Mercurial > rinkhals
comparison gamelib/gameboard.py @ 172:f7f29f1d434b
Don't allow occupied buildings to be sold (dialog can probably be dropped once buildings show their number of occupants).
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Thu, 03 Sep 2009 23:03:39 +0000 |
parents | 92d11e0544bc |
children | ff168162974e |
comparison
equal
deleted
inserted
replaced
171:9ea53eb919cf | 172:f7f29f1d434b |
---|---|
325 tbl = gui.Table() | 325 tbl = gui.Table() |
326 tbl.tr() | 326 tbl.tr() |
327 tbl.td(widget, colspan=2) | 327 tbl.td(widget, colspan=2) |
328 tbl.tr() | 328 tbl.tr() |
329 tbl.td(gui.Spacer(100, 0)) | 329 tbl.td(gui.Spacer(100, 0)) |
330 tbl.td(close_button) | 330 tbl.td(close_button, align=1) |
331 | 331 |
332 self.disp.open(tbl) | 332 self.disp.open(tbl) |
333 return tbl | 333 return tbl |
334 | 334 |
335 def open_building_dialog(self, building): | 335 def open_building_dialog(self, building): |
435 def sell_building(self, tile_pos): | 435 def sell_building(self, tile_pos): |
436 if self.tv.get(tile_pos) == self.FENCE: | 436 if self.tv.get(tile_pos) == self.FENCE: |
437 return self.sell_fence(tile_pos) | 437 return self.sell_fence(tile_pos) |
438 building = self.get_building(tile_pos) | 438 building = self.get_building(tile_pos) |
439 if building is None: | 439 if building is None: |
440 return | |
441 if list(building.occupants()): | |
442 warning = gui.Button("Occupied buildings may not be sold.") | |
443 self.open_dialog(warning) | |
440 return | 444 return |
441 self.add_cash(building.sell_price()) | 445 self.add_cash(building.sell_price()) |
442 building.remove(self.tv) | 446 building.remove(self.tv) |
443 self.remove_building(building) | 447 self.remove_building(building) |
444 | 448 |