diff --git a/src/__pycache__/define.cpython-34.pyc b/src/__pycache__/define.cpython-34.pyc index 66494b8..5a76759 100644 --- a/src/__pycache__/define.cpython-34.pyc +++ b/src/__pycache__/define.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/define.cpython-34.pyc b/src/__pycache__/define.cpython-34.pyc index 66494b8..5a76759 100644 --- a/src/__pycache__/define.cpython-34.pyc +++ b/src/__pycache__/define.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/interpreter.cpython-34.pyc b/src/__pycache__/interpreter.cpython-34.pyc index cdad395..d1c119d 100644 --- a/src/__pycache__/interpreter.cpython-34.pyc +++ b/src/__pycache__/interpreter.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/define.cpython-34.pyc b/src/__pycache__/define.cpython-34.pyc index 66494b8..5a76759 100644 --- a/src/__pycache__/define.cpython-34.pyc +++ b/src/__pycache__/define.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/interpreter.cpython-34.pyc b/src/__pycache__/interpreter.cpython-34.pyc index cdad395..d1c119d 100644 --- a/src/__pycache__/interpreter.cpython-34.pyc +++ b/src/__pycache__/interpreter.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/place.cpython-34.pyc b/src/__pycache__/place.cpython-34.pyc index 53dd235..0d4ce48 100644 --- a/src/__pycache__/place.cpython-34.pyc +++ b/src/__pycache__/place.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/define.cpython-34.pyc b/src/__pycache__/define.cpython-34.pyc index 66494b8..5a76759 100644 --- a/src/__pycache__/define.cpython-34.pyc +++ b/src/__pycache__/define.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/interpreter.cpython-34.pyc b/src/__pycache__/interpreter.cpython-34.pyc index cdad395..d1c119d 100644 --- a/src/__pycache__/interpreter.cpython-34.pyc +++ b/src/__pycache__/interpreter.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/place.cpython-34.pyc b/src/__pycache__/place.cpython-34.pyc index 53dd235..0d4ce48 100644 --- a/src/__pycache__/place.cpython-34.pyc +++ b/src/__pycache__/place.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/server.cpython-34.pyc b/src/__pycache__/server.cpython-34.pyc index a8fe16e..2b5f6f5 100644 --- a/src/__pycache__/server.cpython-34.pyc +++ b/src/__pycache__/server.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/define.cpython-34.pyc b/src/__pycache__/define.cpython-34.pyc index 66494b8..5a76759 100644 --- a/src/__pycache__/define.cpython-34.pyc +++ b/src/__pycache__/define.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/interpreter.cpython-34.pyc b/src/__pycache__/interpreter.cpython-34.pyc index cdad395..d1c119d 100644 --- a/src/__pycache__/interpreter.cpython-34.pyc +++ b/src/__pycache__/interpreter.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/place.cpython-34.pyc b/src/__pycache__/place.cpython-34.pyc index 53dd235..0d4ce48 100644 --- a/src/__pycache__/place.cpython-34.pyc +++ b/src/__pycache__/place.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/server.cpython-34.pyc b/src/__pycache__/server.cpython-34.pyc index a8fe16e..2b5f6f5 100644 --- a/src/__pycache__/server.cpython-34.pyc +++ b/src/__pycache__/server.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/world.cpython-34.pyc b/src/__pycache__/world.cpython-34.pyc index acde556..daad88e 100644 --- a/src/__pycache__/world.cpython-34.pyc +++ b/src/__pycache__/world.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/define.cpython-34.pyc b/src/__pycache__/define.cpython-34.pyc index 66494b8..5a76759 100644 --- a/src/__pycache__/define.cpython-34.pyc +++ b/src/__pycache__/define.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/interpreter.cpython-34.pyc b/src/__pycache__/interpreter.cpython-34.pyc index cdad395..d1c119d 100644 --- a/src/__pycache__/interpreter.cpython-34.pyc +++ b/src/__pycache__/interpreter.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/place.cpython-34.pyc b/src/__pycache__/place.cpython-34.pyc index 53dd235..0d4ce48 100644 --- a/src/__pycache__/place.cpython-34.pyc +++ b/src/__pycache__/place.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/server.cpython-34.pyc b/src/__pycache__/server.cpython-34.pyc index a8fe16e..2b5f6f5 100644 --- a/src/__pycache__/server.cpython-34.pyc +++ b/src/__pycache__/server.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/world.cpython-34.pyc b/src/__pycache__/world.cpython-34.pyc index acde556..daad88e 100644 --- a/src/__pycache__/world.cpython-34.pyc +++ b/src/__pycache__/world.cpython-34.pyc Binary files differ diff --git a/src/interpreter.py b/src/interpreter.py index ada02df..04ce2fc 100644 --- a/src/interpreter.py +++ b/src/interpreter.py @@ -1,8 +1,8 @@ #!/usr/bin/python3 # # Atlantis is a framework for creating multi-user dungeon worlds. -# This module reads in a world file and parses it. The structure of -# the Atlantis language ATL is defined here. +# This module reads in a world file and parses it, using the DefineCommands +# defined in other modules. # # Licensed under the terms of the GPLv3 # author: Daniel Vedder @@ -52,7 +52,7 @@ def interpret_atl(self, atl_source): ''' This method interprets a list of ATL source lines, passing them - on to the relevant define commands. + on to the relevant commands. ''' define_command = None # The define command currently being executed line_no = 0 @@ -62,6 +62,10 @@ # line = line + atl_source[line_no+1] # line_no = line_no+1 line_no = line_no + 1 + if line[-1] != "\n": + # make sure each line ends with a line break, otherwise we run + # into trouble with the last line + line = line+"\n" if len(line) < 2 and define_command: # Empty lines finish off define blocks object_type, game_object = define_command.return_object() @@ -71,7 +75,6 @@ pass #comments and empty lines are ignored else: command = line.split()[0] - print("Line "+str(line_no)+": '"+line+"'\nCommand: '"+command+"'") # execute a line command if command in self.line_command_registry.keys(): self.line_command_registry[command](line[line.find(" ")+1:-1]) @@ -80,7 +83,6 @@ define_command = define_command_registry[command] object_name = line[line.find(" ")+1:-1] define_command.init_object(object_name) - print("Found define command '"+define_command.name) # parse an option command elif line[0] == " " or line[0] == "\t": while line[0] == " " or line[0] == "\t": diff --git a/src/__pycache__/define.cpython-34.pyc b/src/__pycache__/define.cpython-34.pyc index 66494b8..5a76759 100644 --- a/src/__pycache__/define.cpython-34.pyc +++ b/src/__pycache__/define.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/interpreter.cpython-34.pyc b/src/__pycache__/interpreter.cpython-34.pyc index cdad395..d1c119d 100644 --- a/src/__pycache__/interpreter.cpython-34.pyc +++ b/src/__pycache__/interpreter.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/place.cpython-34.pyc b/src/__pycache__/place.cpython-34.pyc index 53dd235..0d4ce48 100644 --- a/src/__pycache__/place.cpython-34.pyc +++ b/src/__pycache__/place.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/server.cpython-34.pyc b/src/__pycache__/server.cpython-34.pyc index a8fe16e..2b5f6f5 100644 --- a/src/__pycache__/server.cpython-34.pyc +++ b/src/__pycache__/server.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/world.cpython-34.pyc b/src/__pycache__/world.cpython-34.pyc index acde556..daad88e 100644 --- a/src/__pycache__/world.cpython-34.pyc +++ b/src/__pycache__/world.cpython-34.pyc Binary files differ diff --git a/src/interpreter.py b/src/interpreter.py index ada02df..04ce2fc 100644 --- a/src/interpreter.py +++ b/src/interpreter.py @@ -1,8 +1,8 @@ #!/usr/bin/python3 # # Atlantis is a framework for creating multi-user dungeon worlds. -# This module reads in a world file and parses it. The structure of -# the Atlantis language ATL is defined here. +# This module reads in a world file and parses it, using the DefineCommands +# defined in other modules. # # Licensed under the terms of the GPLv3 # author: Daniel Vedder @@ -52,7 +52,7 @@ def interpret_atl(self, atl_source): ''' This method interprets a list of ATL source lines, passing them - on to the relevant define commands. + on to the relevant commands. ''' define_command = None # The define command currently being executed line_no = 0 @@ -62,6 +62,10 @@ # line = line + atl_source[line_no+1] # line_no = line_no+1 line_no = line_no + 1 + if line[-1] != "\n": + # make sure each line ends with a line break, otherwise we run + # into trouble with the last line + line = line+"\n" if len(line) < 2 and define_command: # Empty lines finish off define blocks object_type, game_object = define_command.return_object() @@ -71,7 +75,6 @@ pass #comments and empty lines are ignored else: command = line.split()[0] - print("Line "+str(line_no)+": '"+line+"'\nCommand: '"+command+"'") # execute a line command if command in self.line_command_registry.keys(): self.line_command_registry[command](line[line.find(" ")+1:-1]) @@ -80,7 +83,6 @@ define_command = define_command_registry[command] object_name = line[line.find(" ")+1:-1] define_command.init_object(object_name) - print("Found define command '"+define_command.name) # parse an option command elif line[0] == " " or line[0] == "\t": while line[0] == " " or line[0] == "\t": diff --git a/src/place.py b/src/place.py index d092c42..470332e 100644 --- a/src/place.py +++ b/src/place.py @@ -32,7 +32,6 @@ items: a list of instances of items ''' self.name = name - print("Creating place "+name) self.description = description self.neighbours = neighbours self.monsters = monsters @@ -84,6 +83,7 @@ self.add_neighbour) def init_object(self, place_name): + self.place = None self.place = Place(name=place_name) def return_object(self): diff --git a/src/__pycache__/define.cpython-34.pyc b/src/__pycache__/define.cpython-34.pyc index 66494b8..5a76759 100644 --- a/src/__pycache__/define.cpython-34.pyc +++ b/src/__pycache__/define.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/interpreter.cpython-34.pyc b/src/__pycache__/interpreter.cpython-34.pyc index cdad395..d1c119d 100644 --- a/src/__pycache__/interpreter.cpython-34.pyc +++ b/src/__pycache__/interpreter.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/place.cpython-34.pyc b/src/__pycache__/place.cpython-34.pyc index 53dd235..0d4ce48 100644 --- a/src/__pycache__/place.cpython-34.pyc +++ b/src/__pycache__/place.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/server.cpython-34.pyc b/src/__pycache__/server.cpython-34.pyc index a8fe16e..2b5f6f5 100644 --- a/src/__pycache__/server.cpython-34.pyc +++ b/src/__pycache__/server.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/world.cpython-34.pyc b/src/__pycache__/world.cpython-34.pyc index acde556..daad88e 100644 --- a/src/__pycache__/world.cpython-34.pyc +++ b/src/__pycache__/world.cpython-34.pyc Binary files differ diff --git a/src/interpreter.py b/src/interpreter.py index ada02df..04ce2fc 100644 --- a/src/interpreter.py +++ b/src/interpreter.py @@ -1,8 +1,8 @@ #!/usr/bin/python3 # # Atlantis is a framework for creating multi-user dungeon worlds. -# This module reads in a world file and parses it. The structure of -# the Atlantis language ATL is defined here. +# This module reads in a world file and parses it, using the DefineCommands +# defined in other modules. # # Licensed under the terms of the GPLv3 # author: Daniel Vedder @@ -52,7 +52,7 @@ def interpret_atl(self, atl_source): ''' This method interprets a list of ATL source lines, passing them - on to the relevant define commands. + on to the relevant commands. ''' define_command = None # The define command currently being executed line_no = 0 @@ -62,6 +62,10 @@ # line = line + atl_source[line_no+1] # line_no = line_no+1 line_no = line_no + 1 + if line[-1] != "\n": + # make sure each line ends with a line break, otherwise we run + # into trouble with the last line + line = line+"\n" if len(line) < 2 and define_command: # Empty lines finish off define blocks object_type, game_object = define_command.return_object() @@ -71,7 +75,6 @@ pass #comments and empty lines are ignored else: command = line.split()[0] - print("Line "+str(line_no)+": '"+line+"'\nCommand: '"+command+"'") # execute a line command if command in self.line_command_registry.keys(): self.line_command_registry[command](line[line.find(" ")+1:-1]) @@ -80,7 +83,6 @@ define_command = define_command_registry[command] object_name = line[line.find(" ")+1:-1] define_command.init_object(object_name) - print("Found define command '"+define_command.name) # parse an option command elif line[0] == " " or line[0] == "\t": while line[0] == " " or line[0] == "\t": diff --git a/src/place.py b/src/place.py index d092c42..470332e 100644 --- a/src/place.py +++ b/src/place.py @@ -32,7 +32,6 @@ items: a list of instances of items ''' self.name = name - print("Creating place "+name) self.description = description self.neighbours = neighbours self.monsters = monsters @@ -84,6 +83,7 @@ self.add_neighbour) def init_object(self, place_name): + self.place = None self.place = Place(name=place_name) def return_object(self): diff --git a/src/server.py b/src/server.py index f156805..3720a61 100644 --- a/src/server.py +++ b/src/server.py @@ -32,4 +32,5 @@ places = self.world.places.keys() for p in places: print("Place: "+self.world.get_place(p).name) - print("Neighbours: "+str(self.world.get_place(p).neighbours)+"\n") + print("Neighbours: "+str(self.world.get_place(p).neighbours)) + print("Starting place: "+self.world.starting_place) diff --git a/src/__pycache__/define.cpython-34.pyc b/src/__pycache__/define.cpython-34.pyc index 66494b8..5a76759 100644 --- a/src/__pycache__/define.cpython-34.pyc +++ b/src/__pycache__/define.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/interpreter.cpython-34.pyc b/src/__pycache__/interpreter.cpython-34.pyc index cdad395..d1c119d 100644 --- a/src/__pycache__/interpreter.cpython-34.pyc +++ b/src/__pycache__/interpreter.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/place.cpython-34.pyc b/src/__pycache__/place.cpython-34.pyc index 53dd235..0d4ce48 100644 --- a/src/__pycache__/place.cpython-34.pyc +++ b/src/__pycache__/place.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/server.cpython-34.pyc b/src/__pycache__/server.cpython-34.pyc index a8fe16e..2b5f6f5 100644 --- a/src/__pycache__/server.cpython-34.pyc +++ b/src/__pycache__/server.cpython-34.pyc Binary files differ diff --git a/src/__pycache__/world.cpython-34.pyc b/src/__pycache__/world.cpython-34.pyc index acde556..daad88e 100644 --- a/src/__pycache__/world.cpython-34.pyc +++ b/src/__pycache__/world.cpython-34.pyc Binary files differ diff --git a/src/interpreter.py b/src/interpreter.py index ada02df..04ce2fc 100644 --- a/src/interpreter.py +++ b/src/interpreter.py @@ -1,8 +1,8 @@ #!/usr/bin/python3 # # Atlantis is a framework for creating multi-user dungeon worlds. -# This module reads in a world file and parses it. The structure of -# the Atlantis language ATL is defined here. +# This module reads in a world file and parses it, using the DefineCommands +# defined in other modules. # # Licensed under the terms of the GPLv3 # author: Daniel Vedder @@ -52,7 +52,7 @@ def interpret_atl(self, atl_source): ''' This method interprets a list of ATL source lines, passing them - on to the relevant define commands. + on to the relevant commands. ''' define_command = None # The define command currently being executed line_no = 0 @@ -62,6 +62,10 @@ # line = line + atl_source[line_no+1] # line_no = line_no+1 line_no = line_no + 1 + if line[-1] != "\n": + # make sure each line ends with a line break, otherwise we run + # into trouble with the last line + line = line+"\n" if len(line) < 2 and define_command: # Empty lines finish off define blocks object_type, game_object = define_command.return_object() @@ -71,7 +75,6 @@ pass #comments and empty lines are ignored else: command = line.split()[0] - print("Line "+str(line_no)+": '"+line+"'\nCommand: '"+command+"'") # execute a line command if command in self.line_command_registry.keys(): self.line_command_registry[command](line[line.find(" ")+1:-1]) @@ -80,7 +83,6 @@ define_command = define_command_registry[command] object_name = line[line.find(" ")+1:-1] define_command.init_object(object_name) - print("Found define command '"+define_command.name) # parse an option command elif line[0] == " " or line[0] == "\t": while line[0] == " " or line[0] == "\t": diff --git a/src/place.py b/src/place.py index d092c42..470332e 100644 --- a/src/place.py +++ b/src/place.py @@ -32,7 +32,6 @@ items: a list of instances of items ''' self.name = name - print("Creating place "+name) self.description = description self.neighbours = neighbours self.monsters = monsters @@ -84,6 +83,7 @@ self.add_neighbour) def init_object(self, place_name): + self.place = None self.place = Place(name=place_name) def return_object(self): diff --git a/src/server.py b/src/server.py index f156805..3720a61 100644 --- a/src/server.py +++ b/src/server.py @@ -32,4 +32,5 @@ places = self.world.places.keys() for p in places: print("Place: "+self.world.get_place(p).name) - print("Neighbours: "+str(self.world.get_place(p).neighbours)+"\n") + print("Neighbours: "+str(self.world.get_place(p).neighbours)) + print("Starting place: "+self.world.starting_place) diff --git a/worlds/Example/test.atl b/worlds/Example/test.atl index b855b0a..93e5ed5 100644 --- a/worlds/Example/test.atl +++ b/worlds/Example/test.atl @@ -9,4 +9,8 @@ #light \to the north. neighbour Elysium +define-place Elysium + description This is where you want to be when you are six feet under... + neighbour Nowhere + start-place Nowhere \ No newline at end of file