home · contact · privacy
Server/py: Improve replay integration.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 17 Feb 2015 02:46:34 +0000 (03:46 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 17 Feb 2015 02:46:34 +0000 (03:46 +0100)
plomrogue-server.py

index 9bb1559ab0c4462f3125e557691f8153a6f91299..20704308545fead9275f4092ad794fb74b5d17ea 100755 (executable)
@@ -65,17 +65,19 @@ try:
     parser = argparse.ArgumentParser()
     parser.add_argument('-s', nargs='?', type=int, dest='replay', const=1,
                         action='store')
-    args, unknown = parser.parse_known_args()
-    replay = args.replay
-    # print("DUMMY: Obey command-line arguments.")
+    opts, unknown = parser.parse_known_args()
+    print(opts)
     setup_server_io(io_db)
     # print("DUMMY: Run game.")
     path_recordfile = "recordfile"
     path_savefile = "savefile"
     detect_atomic_leftover(path_savefile)
     detect_atomic_leftover(path_recordfile)
-    if replay:
-        print("Replaying")
+    if None != opts.replay:
+        if opts.replay < 1:
+            opts.replay = 1
+        print("Replay mode. Auto-replaying up to turn " + str(opts.replay) +
+              " (if so late  a turn is to be found).")
     elif os.access(path_savefile, os.F_OK):
         print(open(path_savefile, "r").read())
     else: