changeset 193:db246683d5da

Selling eggs now works
author Neil Muller <drnlmuller@gmail.com>
date Fri, 04 Sep 2009 18:45:06 +0000
parents a490ee2ef446
children 5ec222ca07cd
files gamelib/gameboard.py
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/gameboard.py	Fri Sep 04 18:17:55 2009 +0000
+++ b/gamelib/gameboard.py	Fri Sep 04 18:45:06 2009 +0000
@@ -306,11 +306,20 @@
 
     def sell_egg(self, tile_pos):
         def do_sell(chicken):
-            # Placeholde
+            if chicken.egg:
+                # We sell the egg
+                self.add_cash(constants.SELL_PRICE_CHICKEN)
+                sound.play_sound("sell-chicken.ogg")
+                chicken.egg = None
+                self.eggs -= 1
+                self.toolbar.update_egg_counter(self.eggs)
+                # Force update
+                self.toolbar.chsize()
             return False
+
         building = self.get_building(tile_pos)
         if building and building.NAME in buildings.HENHOUSES:
-            self.open_building_dialog(building)
+            self.open_building_dialog(building, do_sell)
 
     def place_animal(self, tile_pos):
         """Handle an TOOL_PLACE_ANIMALS click.