diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/game/sol_rules.h | 1 | ||||
| -rw-r--r-- | src/main/input-output/input/json-parsing/rules_parser.cpp | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/main/game/sol_rules.h b/src/main/game/sol_rules.h index 6afb238..5c7713c 100644 --- a/src/main/game/sol_rules.h +++ b/src/main/game/sol_rules.h @@ -38,6 +38,7 @@ struct sol_rules { bool foundations_init_card; uint8_t cells; uint8_t stock_size; + uint8_t reserve_size; }; #endif //SOLVITAIRE_SOL_RULES_H 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 3c372ae..cc893fa 100644 --- a/src/main/input-output/input/json-parsing/rules_parser.cpp +++ b/src/main/input-output/input/json-parsing/rules_parser.cpp @@ -178,4 +178,12 @@ void rules_parser::modify_sol_rules(sol_rules& sr, Document& d) { json_helper::json_parse_err("[stock size] must be an integer"); } } + + if (d.HasMember("reserve size")) { + if (d["reserve size"].IsInt()) { + sr.reserve_size = static_cast<uint8_t>(d["reserve size"].GetInt()); + } else { + json_helper::json_parse_err("[reserve size] must be an integer"); + } + } } |
