comparison gamelib/gameboard.py @ 216:962934b8c7dc

Implement UI part of egg selling
author Neil Muller <drnlmuller@gmail.com>
date Fri, 04 Sep 2009 22:04:04 +0000
parents 85a5299caf4a
children 76faa0eb38f0
comparison
equal deleted inserted replaced
215:85a5299caf4a 216:962934b8c7dc
352 def do_sell(chicken): 352 def do_sell(chicken):
353 if chicken.egg: 353 if chicken.egg:
354 # We sell the egg 354 # We sell the egg
355 self.add_cash(constants.SELL_PRICE_EGG) 355 self.add_cash(constants.SELL_PRICE_EGG)
356 sound.play_sound("sell-chicken.ogg") 356 sound.play_sound("sell-chicken.ogg")
357 chicken.egg = None 357 chicken.remove_egg()
358 self.eggs -= 1 358 self.eggs -= 1
359 self.toolbar.update_egg_counter(self.eggs) 359 self.toolbar.update_egg_counter(self.eggs)
360 # Force update 360 # Force update
361 self.toolbar.chsize() 361 self.toolbar.chsize()
362 return False 362 return False
478 else: 478 else:
479 # Attempt to sell the occupant 479 # Attempt to sell the occupant
480 if sell_callback(place.occupant): 480 if sell_callback(place.occupant):
481 # empty the nest (on button) 481 # empty the nest (on button)
482 update_button(place.occupant, empty=True) 482 update_button(place.occupant, empty=True)
483 else:
484 # Update for equipment changes, etc.
485 update_button(place.occupant)
483 else: 486 else:
484 # there is no occupant, attempt to fill the space 487 # there is no occupant, attempt to fill the space
485 if self.animal_to_place is not None: 488 if self.animal_to_place is not None:
486 # empty old nest (on button) 489 # empty old nest (on button)
487 update_button(self.animal_to_place, empty=True) 490 update_button(self.animal_to_place, empty=True)