diff options
| author | Charlie Blake | 2018-06-25 12:38:18 +0100 |
|---|---|---|
| committer | Charlie Blake | 2018-06-25 12:38:18 +0100 |
| commit | b9822b9fe08f423a32d5218ec8ce8bbcbf4c3a98 (patch) | |
| tree | df43bd847c85ca4e6bd9abf70340de802f5af265 /src/main | |
| parent | Add state printing for face down cards (diff) | |
| download | metasol-b9822b9fe08f423a32d5218ec8ce8bbcbf4c3a98.tar.gz metasol-b9822b9fe08f423a32d5218ec8ce8bbcbf4c3a98.zip | |
Correct face up rules parsing bug
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/input-output/input/json-parsing/rules_parser.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/main/input-output/input/json-parsing/rules_parser.cpp b/src/main/input-output/input/json-parsing/rules_parser.cpp index 91f6549..29e755b 100644 --- a/src/main/input-output/input/json-parsing/rules_parser.cpp +++ b/src/main/input-output/input/json-parsing/rules_parser.cpp @@ -166,17 +166,20 @@ void rules_parser::modify_sol_rules(sol_rules& sr, Document& d) { if (d["tableau piles"].HasMember("face up cards")) { if (d["tableau piles"]["face up cards"].IsString()) { face_up_str = d["tableau piles"]["face up cards"].GetString(); + + if (face_up_str == "all") { + sr.face_up = fu::ALL; + } else if (face_up_str == "top") { + sr.face_up = fu::TOP_CARDS; + } else { + string err = "[tableau piles][face up cards] is invalid: " + face_up_str; + json_helper::json_parse_err(err); + } + } else { json_helper::json_parse_err("[tableau piles][face up cards] must be a string"); } } - if (face_up_str == "all") { - sr.face_up = fu::ALL; - } else if (face_up_str == "top") { - sr.face_up = fu::TOP_CARDS; - } else { - json_helper::json_parse_err("[tableau piles][face up cards] is invalid"); - } } else { json_helper::json_parse_err("[tableau piles] must be an object"); |
