From 70522b28586ba117ff9e1e27c8f4b183f8414fd1 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Sat, 28 Oct 2017 10:13:13 +0100 Subject: Add simple and regular bh types --- src/main/command_line_helper.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/main/command_line_helper.cpp') diff --git a/src/main/command_line_helper.cpp b/src/main/command_line_helper.cpp index 67bf7ff..fdf6c9c 100644 --- a/src/main/command_line_helper.cpp +++ b/src/main/command_line_helper.cpp @@ -75,18 +75,35 @@ bool command_line_helper::assess_errors() { return false; } - if (random_deal && !input_files.empty()) { + bool valid_sol_type = assess_sol_type(); + if (!valid_sol_type) return false; + + if (random_deal >= 0 && !input_files.empty()) { print_rand_plus_input_err(); return false; } - if (input_files.empty() && !random_deal) { + if (input_files.empty() && random_deal >= 0) { print_no_input_error(); return false; } return true; } +bool command_line_helper::assess_sol_type() { + if (solitaire_type == "black-hole") { + return true; + } else if (solitaire_type == "simple-black-hole") { + return true; + } else { + cerr << "Error: Solitaire type is not valid: " << solitaire_type + << "\nValid solitaire types are: 'black-hole' and " + "'simple-black-hole'"; + print_help(); + return false; + } +} + void command_line_helper::print_help() { cout << "Usage: solvitaire [options] input-file1 input-file2 ...\n" << main_options << "\n"; -- cgit v1.2.1