From cfdcfc33f5bb9e3d9313295f9451b728fdb36ff7 Mon Sep 17 00:00:00 2001 From: Dinko Galetic Date: Wed, 09 Jun 2010 14:03:29 +0000 Subject: 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. --- (limited to 'library') 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 -- cgit v0.9.1