# HG changeset patch # User Simon Cross # Date 1259101266 0 # Node ID fbbd39cfc975c76d2b9a350386439a269fba2aa3 # Parent e0b11d684ee8b100bfe5e8468ebe0475c986e3b4 Alter day counter logic a bit to cater for the case when it stops being the last day. diff -r e0b11d684ee8 -r fbbd39cfc975 gamelib/gameboard.py --- a/gamelib/gameboard.py Tue Nov 24 22:19:53 2009 +0000 +++ b/gamelib/gameboard.py Tue Nov 24 22:21:06 2009 +0000 @@ -154,6 +154,11 @@ def redraw_counters(self): self.toolbar.update_egg_counter(self.eggs) + if self.level.is_last_day(self.days): + self.toolbar.day_counter.style.color = (255, 0, 0) + else: + # can come back from last day when restoring a saved game + self.toolbar.day_counter.style.color = (255, 255, 255) self.toolbar.update_day_counter("%s/%s" % (self.days, self.level.get_max_turns())) self.toolbar.update_chicken_counter(len(self.chickens)) @@ -225,7 +230,7 @@ self.clear_foxes() for chicken in self.chickens.copy(): chicken.start_day(self) - self.toolbar.update_egg_counter(self.eggs) + self.redraw_counters() def in_bounds(self, pos): """Check if a position is within the game boundaries""" @@ -613,10 +618,6 @@ def advance_day(self): self.days += 1 - if self.level.is_last_day(self.days): - self.toolbar.day_counter.style.color = (255, 0, 0) - self.toolbar.update_day_counter("%s/%s" % (self.days, - self.level.get_max_turns())) def clear_foxes(self): for fox in self.foxes.copy():