Add auto-procure option to the CLI generator.

This commit is contained in:
Dan Albert 2020-12-05 23:20:58 -08:00
parent f2d2fd7014
commit 6a8ca810ff

View File

@ -123,15 +123,25 @@ def parse_args() -> argparse.Namespace:
help="Use the supercarrier module." help="Use the supercarrier module."
) )
new_game.add_argument(
"--auto-procurement", action="store_true",
help="Automate bluefor procurement."
)
return parser.parse_args() return parser.parse_args()
def create_game(campaign_path: Path, blue: str, red: str, def create_game(campaign_path: Path, blue: str, red: str,
supercarrier: bool) -> Game: supercarrier: bool, auto_procurement: bool) -> Game:
campaign = Campaign.from_json(campaign_path) campaign = Campaign.from_json(campaign_path)
generator = GameGenerator( generator = GameGenerator(
blue, red, campaign.load_theater(), blue, red, campaign.load_theater(),
Settings(supercarrier=supercarrier), Settings(
supercarrier=supercarrier,
automate_runway_repair=auto_procurement,
automate_front_line_reinforcements=auto_procurement,
automate_aircraft_reinforcements=auto_procurement
),
GeneratorSettings( GeneratorSettings(
start_date=datetime.today(), start_date=datetime.today(),
player_budget=DEFAULT_BUDGET, player_budget=DEFAULT_BUDGET,
@ -159,7 +169,7 @@ def main():
args = parse_args() args = parse_args()
if args.subcommand == "new-game": if args.subcommand == "new-game":
game = create_game(args.campaign, args.blue, args.red, game = create_game(args.campaign, args.blue, args.red,
args.supercarrier) args.supercarrier, args.auto_procurement)
run_ui(game) run_ui(game)