From 5cb3715ac847166eafc970819160792351dee952 Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Sat, 17 May 2014 13:39:23 +0200 Subject: [PATCH] Add deck loading. --- naja/options.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/naja/options.py b/naja/options.py index efde88c..dd3e69d 100644 --- a/naja/options.py +++ b/naja/options.py @@ -13,9 +13,9 @@ def load_game(parser, slot_num): ''' Load a save game and store it in parser.values.game_state. ''' + from naja.scenes.load_save import SaveGameSlot if not (0 <= slot_num <= 7): parser.error("--load accepts a slot number from 0 to 7.") - from naja.scenes.load_save import SaveGameSlot state = SaveGameSlot(slot_num).load() if state is None: raise parser.error( @@ -28,8 +28,12 @@ def load_deck(parser, deck): Create a new game for a specific deck and store it in parser.values.game_state. ''' - raise optparse.OptionalValueError( - "Deck loading not implemented.") + from naja.gamestate import GameState + try: + state = GameState.new(deck=deck, max_health=4, wins_required=4) + except: + parser.error("Could not load deck %r" % (deck,)) + options.game_state = state def parse_args(args): -- 2.34.1