X-Git-Url: https://plomlompom.com/repos/te"st.html?a=blobdiff_plain;f=server.py;h=ac26ca7f1c39dd0e1853c038ff80df2a393b2844;hb=52a7b4e9b1ef3e38701409d963f49033c23d4eaf;hp=9ba6d6fe24fdbf87cec3df148f281e24bc51ff5b;hpb=992fc9b392c4318bd2fda31f526ea838b0138a9e;p=plomrogue2-experiments diff --git a/server.py b/server.py index 9ba6d6f..ac26ca7 100755 --- a/server.py +++ b/server.py @@ -9,7 +9,7 @@ if len(sys.argv) != 2: print('wrong number of arguments, expected one (game file)') exit(1) game_file_name = sys.argv[1] -command_handler = server_.game.CommandHandler(game_file_name) +game = server_.game.Game(game_file_name) if os.path.exists(game_file_name): if not os.path.isfile(game_file_name): print('game file name does not refer to a valid game file') @@ -19,18 +19,18 @@ if os.path.exists(game_file_name): for i in range(len(lines)): line = lines[i] print("FILE INPUT LINE %s: %s" % (i, line), end='') - command_handler.handle_input(line, store=False) + game.io.handle_input(line, store=False) else: - command_handler.handle_input('MAP_SIZE Y:5,X:5') - command_handler.handle_input('TERRAIN_LINE 0 "xxxxx"') - command_handler.handle_input('TERRAIN_LINE 1 "x...x"') - command_handler.handle_input('TERRAIN_LINE 2 "x.X.x"') - command_handler.handle_input('TERRAIN_LINE 3 "x...x"') - command_handler.handle_input('TERRAIN_LINE 4 "xxxxx"') - command_handler.handle_input('THING_TYPE 0 human') - command_handler.handle_input('THING_POS 0 Y:3,X:3') - command_handler.handle_input('THING_TYPE 1 monster') - command_handler.handle_input('THING_POS 1 Y:1,X:1') + game.io.handle_input('MAP_SIZE Y:5,X:5') + game.io.handle_input('TERRAIN_LINE 0 "xxxxx"') + game.io.handle_input('TERRAIN_LINE 1 "x...x"') + game.io.handle_input('TERRAIN_LINE 2 "x.X.x"') + game.io.handle_input('TERRAIN_LINE 3 "x...x"') + game.io.handle_input('TERRAIN_LINE 4 "xxxxx"') + game.io.handle_input('THING_TYPE 0 human') + game.io.handle_input('THING_POS 0 Y:3,X:3') + game.io.handle_input('THING_TYPE 1 monster') + game.io.handle_input('THING_POS 1 Y:1,X:1') -server_.io.run_server_with_io_loop(command_handler) +server_.io.run_server_with_io_loop(game)