home · contact · privacy
Merge branch 'master' into 7drl2016
[plomrogue] / roguelike-server
index abd2f2fcdfb3a41815cb6002ccfd7e8be9b250ce..414f765a29f356ce35dada5916be0ce2ecebcd73 100755 (executable)
@@ -47,11 +47,10 @@ def play_game():
     if os.access(io_db["path_save"], os.F_OK):
         obey_lines_in_file(io_db["path_save"], "save")
     else:
-        if not os.access(io_db["path_worldconf"], os.F_OK):
+        if not os.access(opts.worldconf, os.F_OK):
             msg = "No world config file from which to start a new world."
             raise SystemExit(msg)
-        obey_lines_in_file(io_db["path_worldconf"], "world config ",
-                           do_record=True)
+        obey_lines_in_file(opts.worldconf, "world config ", do_record=True)
         obey("MAKE_WORLD " + str(int(time.time())), "in file", do_record=True)
     while True:
         try_worldstate_update()
@@ -65,11 +64,16 @@ try:
     if opts.savefile:
         io_db["path_save"] = opts.savefile
         io_db["path_record"] = "record_" + opts.savefile
+    import os
+    if opts.new:
+        if os.access(io_db["path_record"], os.F_OK):
+            os.remove(io_db["path_record"])
+        if os.access(io_db["path_save"], os.F_OK):
+            os.remove(io_db["path_save"])
     from server.io import setup_server_io
     setup_server_io()
     if opts.verbose:
         io_db["verbose"] = True
-    import os
     from server.config.world_data import world_db
     from server.io import read_command, try_worldstate_update, obey
     if None != opts.replay:
@@ -77,7 +81,8 @@ try:
     else:
         play_game()
 except SystemExit as exit:
-    print("ABORTING: " + exit.args[0])
+    if len(exit.args) < 2 and exit.args[0] != 0:
+        print("ABORTING: " + str(exit.args[0]))
 except:
     print("SOMETHING WENT WRONG IN UNEXPECTED WAYS")
     raise