diff gamelib/buildings.py @ 561:7f037ee2a6c8

Show count of selected chickens in buildings
author Neil Muller <drnlmuller@gmail.com>
date Sat, 28 Nov 2009 18:40:04 +0000
parents 50d6c68ce267
children
line wrap: on
line diff
--- a/gamelib/buildings.py	Sat Nov 28 18:27:59 2009 +0000
+++ b/gamelib/buildings.py	Sat Nov 28 18:40:04 2009 +0000
@@ -293,6 +293,13 @@
                 # Blit to the right
                 x, y = text.get_size()
                 image.blit(text, (w - x, h - y))
+                sel_count = len([chick for chick in self.occupants()
+                    if chick in self.gameboard.selected_chickens])
+                if sel_count:
+                    text = self._font.render(str(sel_count), True,
+                            constants.SELECTED_COUNT_COLOR)
+                    x, y = text.get_size()
+                    image.blit(text, (0, h - y))
             # Render predator count
             if self._predators:
                 text = self._font.render(str(len(self._predators)), True,