Mercurial > sypikslang
diff gamelib/gamestate.py @ 228:3955d126ca26
merge
author | Rizmari Versfeld <rizziepit@gmail.com> |
---|---|
date | Sat, 12 May 2012 23:09:33 +0200 |
parents | e4f9513c9dd0 |
children |
line wrap: on
line diff
--- a/gamelib/gamestate.py Sat May 12 23:09:16 2012 +0200 +++ b/gamelib/gamestate.py Sat May 12 23:09:33 2012 +0200 @@ -47,7 +47,11 @@ basic_research, suggestions = self.lab.suggest_research() if basic_research: suggestions.append(None) - self.advice = choice(suggestions) + try: + self.advice = choice(suggestions) + except IndexError: + # We have an empty list of suggestions + self.advice = None if self.advice is None: self.advice = ("Leave some researchers unassigned." " They might turn up something cool.") @@ -90,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] @@ -100,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) @@ -110,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