aboutsummaryrefslogtreecommitdiff
path: root/src/main/command_line_helper.cpp
diff options
context:
space:
mode:
authorthecharlesblake2017-10-28 10:13:13 +0100
committerthecharlesblake2017-10-28 10:13:13 +0100
commit70522b28586ba117ff9e1e27c8f4b183f8414fd1 (patch)
tree7ab7edafbbec14406f876e2bca72b0eb69411b26 /src/main/command_line_helper.cpp
parentAdd random game generation to bh (diff)
downloadmetasol-70522b28586ba117ff9e1e27c8f4b183f8414fd1.tar.gz
metasol-70522b28586ba117ff9e1e27c8f4b183f8414fd1.zip

Add simple and regular bh types

Diffstat (limited to 'src/main/command_line_helper.cpp')
-rw-r--r--src/main/command_line_helper.cpp21
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";