From: Christian Heller Date: Tue, 17 Feb 2015 02:46:34 +0000 (+0100) Subject: Server/py: Improve replay integration. X-Git-Tag: tce~523 X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7Byoutube_prefix%7D%7D%7B%7Bvideo_id%7D%7D?a=commitdiff_plain;h=88f9b0f3a072b8d796f06a620f3a1170a96e3358;p=plomrogue Server/py: Improve replay integration. --- 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: