changeset 362:4e939b3c73f8

Allow Nones in list of results
author Neil Muller <neil@dip.sun.ac.za>
date Sat, 28 Aug 2010 17:07:24 +0200
parents 9d97d2e338db
children 2cadb47405a4
files gamelib/scenes/crew_quarters.py gamelib/scenes/cryo.py gamelib/state.py
diffstat 3 files changed, 13 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/scenes/crew_quarters.py	Sat Aug 28 16:56:09 2010 +0200
+++ b/gamelib/scenes/crew_quarters.py	Sat Aug 28 17:07:24 2010 +0200
@@ -87,16 +87,13 @@
         # TODO: Wax lyrical some more about safecracking.
         self.set_data('is_cracked', True)
         self.set_interact('full_safe')
-        open_result = Result("Even after centuries of neglect, the tumblers slide"
+        return (Result("Even after centuries of neglect, the tumblers slide"
                       " almost silently into place. Turns out the combination"
                       " was '1 2 3 4 5'. An idiot must keep his luggage in"
-                      " here.")
-        ai_result = make_jim_dialog("Prisoner %s, you have been observed commiting a felony violation. "
-                    "This will go onto your permenant record, and your sentence may be extended by up to twenty years."
-                    % PLAYER_ID, self.state)
-        if ai_result:
-            return open_result, ai_result
-        return open_result
+                      " here."),
+                      make_jim_dialog("Prisoner %s, you have been observed commiting a felony violation. "
+                          "This will go onto your permenant record, and your sentence may be extended by up to twenty years."
+                          % PLAYER_ID, self.state))
 
     def get_description(self):
         return "Ah, a vintage Knoxx & Co. model QR3. Quaint, but reasonably secure."
--- a/gamelib/scenes/cryo.py	Sat Aug 28 16:56:09 2010 +0200
+++ b/gamelib/scenes/cryo.py	Sat Aug 28 17:07:24 2010 +0200
@@ -165,15 +165,11 @@
             self.state.add_item(pipe)
             self.state.add_inventory_item(pipe.name)
             self.set_interact("chopped")
-            result = Result("It takes more effort than one would expect, but "
-                          "eventually the pipe is separated from the wall.")
-            ai_result = make_jim_dialog("Prisoner %s. Vandalism is an offence "
-                    "punishable by a minimum of an additional 6 months "
-                    "to your sentence" % PLAYER_ID, self.state)
-            if ai_result:
-                return result, ai_result
-            return result
-
+            return (Result("It takes more effort than one would expect, but "
+                          "eventually the pipe is separated from the wall."),
+                          make_jim_dialog("Prisoner %s. Vandalism is an offence "
+                              "punishable by a minimum of an additional 6 months "
+                              "to your sentence" % PLAYER_ID, self.state))
 
     def is_interactive(self):
         return self.get_data('fixed')
--- a/gamelib/state.py	Sat Aug 28 16:56:09 2010 +0200
+++ b/gamelib/state.py	Sat Aug 28 17:07:24 2010 +0200
@@ -43,7 +43,9 @@
             result.process(scene_widget)
         else:
             for res in result:
-                res.process(scene_widget)
+                if res:
+                    # List may contain None's
+                    res.process(scene_widget)
 
 
 def initial_state():