diff options
Diffstat (limited to 'src/main/command_line_helper.cpp')
| -rw-r--r-- | src/main/command_line_helper.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
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"; |
