Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDinko Galetic <dgaletic@everflame.(none)>2010-06-09 14:03:29 (GMT)
committer Dinko Galetic <dgaletic@everflame.(none)>2010-06-09 14:03:29 (GMT)
commitcfdcfc33f5bb9e3d9313295f9451b728fdb36ff7 (patch)
treeb4dec4665c3da7952cbbbfc50f79f0214a3e6522
parentffc08d7632905e12e6df4aa32a665affdf44be26 (diff)
On class Room: made add_exit() return True or False depending on the success. Added a thought to comments about sharing an object between rooms.
-rw-r--r--library/pippy/scholar/scholar.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/library/pippy/scholar/scholar.py b/library/pippy/scholar/scholar.py
index 881912e..87d246a 100644
--- a/library/pippy/scholar/scholar.py
+++ b/library/pippy/scholar/scholar.py
@@ -32,16 +32,19 @@ class Room(GameObject):
# TODO: Think about the case when two rooms share one object
# (such as a door)
+ # It probably won't be an issue at all - just add it to the
+ # .contains attribute of both rooms - it really is the same object.
def add_exit(self, through, to, two_way = True):
if self.exits.has_key(through) == False:
if two_way:
if to.exits.has_key(opposite_exit(through)) == False:
to.exits[opposite_exit(through)] = self
else:
- return "That room already has that exit"
+ return False
self.exits[through] = to
+ return True
else:
- return "This room already has this exit"
+ return False
#### functions