Mercurial > sypikslang
diff gamelib/gamestate.py @ 80:a40a76012bd7
Refactor message handling so we can deal with in the gui
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Wed, 09 May 2012 12:08:44 +0200 |
parents | 364ff3479ef2 |
children | 59afe9f92383 |
line wrap: on
line diff
--- a/gamelib/gamestate.py Wed May 09 00:31:11 2012 +0200 +++ b/gamelib/gamestate.py Wed May 09 12:08:44 2012 +0200 @@ -5,6 +5,7 @@ from gamelib import missions, lab from gamelib.game_base import get_subclasses +from gamelib.constants import NEW_SCIENCE, NEW_SCHEMATIC class Game(object): @@ -60,11 +61,20 @@ new_stuff = self.lab.spend_points(self.cur_allocation, self.points) self.points = 0 # Process mission results + messages = [] for result in mission_results: result.apply(self) + messages.append((result.outcome, result.msg)) for science in new_stuff: # FIXME: Update UI better. - print "You learned new stuff:", science.NAME + if science.SCIENCE_TYPE == 'research': + messages.append((NEW_SCIENCE, + "You've started a new line of research in %s" + % science.NAME)) + else: + messages.append((NEW_SCHEMATIC, + "You've developed blueprints for a %s" % science.NAME)) + return messages def save_data(self): """Serialize the game state into a dict"""