From 88f9b0f3a072b8d796f06a620f3a1170a96e3358 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Tue, 17 Feb 2015 03:46:34 +0100 Subject: [PATCH] Server/py: Improve replay integration. --- plomrogue-server.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plomrogue-server.py b/plomrogue-server.py index 9bb1559..2070430 100755 --- a/plomrogue-server.py +++ b/plomrogue-server.py @@ -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: -- 2.30.2