# HG changeset patch # User Neil Muller # Date 1336854785 -7200 # Node ID e4f9513c9dd08e2b46e22bed3f41de13f2bc9e3d # Parent 19aae2b701d146e6c90dee36affad2ad6b2793ec Include mission name in the results diff -r 19aae2b701d1 -r e4f9513c9dd0 gamelib/gamegui.py --- a/gamelib/gamegui.py Sat May 12 21:28:43 2012 +0200 +++ b/gamelib/gamegui.py Sat May 12 22:33:05 2012 +0200 @@ -403,13 +403,15 @@ self.add_child(results) else: y = 200 - for msg_type, msg, loot in messages: + for mission, msg_type, msg, loot in messages: # FIXME: Better widgets if msg_type == GAME_WIN: self._make_win_screen(turn, msg) self.is_game_over = True break colour = self.message_colours.get(msg_type, (255, 255, 255)) + if mission: + msg = '%s: %s' % (mission, msg) y = self.display_message(y, msg, loot, colour) def display_message(self, y, msg, loot, colour, font=font_medium): diff -r 19aae2b701d1 -r e4f9513c9dd0 gamelib/gamestate.py --- a/gamelib/gamestate.py Sat May 12 21:28:43 2012 +0200 +++ b/gamelib/gamestate.py Sat May 12 22:33:05 2012 +0200 @@ -94,7 +94,8 @@ # Attempt the missions mission_results = [] for mission, equipment in self.cur_missions: - mission_results.append(mission.attempt_mission(equipment, self)) + mission_results.append((mission.NAME, + mission.attempt_mission(equipment, self))) if not self.cur_missions and self.reputation > 0: # If you're not doing stuff, you're not in the news self.reputation -= M_VALS[self.milestone] @@ -104,9 +105,9 @@ raise RuntimeError('Spent too many points') # Process mission results messages = [] - for result in mission_results: + for miss, result in mission_results: result.apply(self) - messages.append((result.outcome, result.text, result.loot)) + messages.append((miss, result.outcome, result.text, result.loot)) # Missions may give us science breakthroughs, so handle this after # mission results new_stuff = self.lab.spend_points(self.cur_allocation, self.points) @@ -114,7 +115,7 @@ self.minions = 0 for science in new_stuff: # FIXME: Update UI better. - messages.append((INFO, "SCIENCE breakthrough!", { + messages.append((None, INFO, "SCIENCE breakthrough!", { science.SCIENCE_TYPE: science})) return messages diff -r 19aae2b701d1 -r e4f9513c9dd0 gamelib/tests/repl_game.py --- a/gamelib/tests/repl_game.py Sat May 12 21:28:43 2012 +0200 +++ b/gamelib/tests/repl_game.py Sat May 12 22:33:05 2012 +0200 @@ -64,7 +64,9 @@ self.game.cur_missions.extend(missions) print "-" * 10, "RESULTS", "-" * 31 messages = self.game.end_turn() - for msg_type, msg in messages: + for miss, msg_type, msg in messages: + if miss: + print 'Mission: %s' % miss if msg_type == NEW_SCIENCE or msg_type == NEW_SCHEMATIC: print msg elif msg_type == FAILURE: