Start changing conditional expressions to statements.
authorNeil Moore <neil.moore@csurs.csr.uky.edu>
Fri, 6 Jun 2008 17:58:27 +0000 (13:58 -0400)
committerNeil Moore <neil.moore@csurs.csr.uky.edu>
Fri, 6 Jun 2008 17:58:27 +0000 (13:58 -0400)
loc.py

diff --git a/loc.py b/loc.py
index 695d72a..acaae0d 100644 (file)
--- a/loc.py
+++ b/loc.py
@@ -51,11 +51,20 @@ class Location (object):
         elif obj.is_scenery():
             self._scenery[:0] = [obj]
     def top_item(self):
-        return self._items[0] if len(self._items) > 0 else None
+        if len(self._items) > 0:
+            return self._items[0]
+        else:
+            return None
     def top_creature(self):
-        return self._creatures[0] if len(self._creatures) > 0 else None
+        if len(self._creatures) > 0:
+            return self._creatures[0]
+        else:
+            return None
     def top_scenery(self):
-        return self._scenery[0] if len(self._scenery) > 0 else None
+        if len(self._scenery) > 0:
+            return self._scenery[0]
+        else:
+            return None
     def container(self):
         return self._parent
     def level(self):
@@ -306,9 +315,15 @@ class Door(Tile):
             return False
     def setattr(self, attr, value):
         if attr == 'hidden':
-            self.hide() if value else self.unhide()
+            if value:
+                self.hide()
+            else:
+                self.unhide()
         elif attr == 'opened':
-            self.open() if value else self.hide()
+            if value:
+                self.open()
+            else:
+                self.close()
         else:
             raise Exception("Unknown attr %s for %s" % (attr, self.__class__))
     def passable_by(self, thing):