From dfecd22e848447fbecdfb045a1477209e965e7ed Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Mon, 5 Feb 2018 15:31:39 +0000 Subject: Add "foundations removable" field to rules JSON --- src/main/input-output/input/sol_preset_types.cpp | 25 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/main/input-output') diff --git a/src/main/input-output/input/sol_preset_types.cpp b/src/main/input-output/input/sol_preset_types.cpp index 8f0293f..eeb0edc 100644 --- a/src/main/input-output/input/sol_preset_types.cpp +++ b/src/main/input-output/input/sol_preset_types.cpp @@ -32,6 +32,7 @@ std::map sol_preset_types::mp = { "hole": false, "foundations": true, "foundations initial card": false, + "foundations removable": false, "cells": 0, "stock size": 0, "stock deal type": "waste", @@ -48,7 +49,8 @@ std::map sol_preset_types::mp = { { "tableau piles": { "count": 13 - } + }, + "foundations removable": true } )" @@ -61,7 +63,8 @@ std::map sol_preset_types::mp = { "tableau piles": { "count": 3 }, - "max rank": 2 + "max rank": 2, + "foundations removable": true } )" @@ -102,7 +105,8 @@ std::map sol_preset_types::mp = { "tableau piles": { "count": 13, "spaces policy": "no-build" - } + }, + "foundations removable": true } )" @@ -116,7 +120,8 @@ std::map sol_preset_types::mp = { "count": 3, "spaces policy": "no-build" }, - "max rank": 3 + "max rank": 3, + "foundations removable": true } )" @@ -192,7 +197,8 @@ std::map sol_preset_types::mp = { "count": 6 }, "reserve size": 16 -} +}, + "foundations removable": true )" }, @@ -206,7 +212,8 @@ std::map sol_preset_types::mp = { }, "max rank": 3, "reserve size": 3 -} +}, + "foundations removable": true )" }, @@ -252,7 +259,8 @@ std::map sol_preset_types::mp = { "count": 10, "build policy": "red-black", "diagonal deal": true - } + }, + "foundations removable": true } )" @@ -267,7 +275,8 @@ std::map sol_preset_types::mp = { "build policy": "red-black", "diagonal deal": true }, - "max rank": 2 + "max rank": 2, + "foundations removable": true } )" -- cgit v1.2.1 From 793b3c253cac90a748fa16c20d185505e5fe6808 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Mon, 5 Feb 2018 15:57:21 +0000 Subject: Fix json bug in sol presets --- src/main/input-output/input/sol_preset_types.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main/input-output') diff --git a/src/main/input-output/input/sol_preset_types.cpp b/src/main/input-output/input/sol_preset_types.cpp index eeb0edc..de0fd41 100644 --- a/src/main/input-output/input/sol_preset_types.cpp +++ b/src/main/input-output/input/sol_preset_types.cpp @@ -196,9 +196,9 @@ std::map sol_preset_types::mp = { "tableau piles": { "count": 6 }, - "reserve size": 16 -}, + "reserve size": 16, "foundations removable": true +} )" }, @@ -211,9 +211,9 @@ std::map sol_preset_types::mp = { "count": 3 }, "max rank": 3, - "reserve size": 3 -}, + "reserve size": 3, "foundations removable": true +} )" }, -- cgit v1.2.1 From f907ddd96ae6886b6c541d22c1f44628b64289d4 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Mon, 5 Feb 2018 15:57:39 +0000 Subject: Add foundations removable rule parsing --- src/main/input-output/input/json-parsing/rules_parser.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main/input-output') 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 7b9de84..395f2e7 100644 --- a/src/main/input-output/input/json-parsing/rules_parser.cpp +++ b/src/main/input-output/input/json-parsing/rules_parser.cpp @@ -181,6 +181,14 @@ void rules_parser::modify_sol_rules(sol_rules& sr, Document& d) { } } + if (d.HasMember("foundations removable")) { + if (d["foundations removable"].IsBool()) { + sr.foundations_removable = d["foundations removable"].GetBool(); + } else { + json_helper::json_parse_err("[foundations removable] must be a boolean"); + } + } + if (d.HasMember("cells")) { if (d["cells"].IsInt()) { sr.cells = static_cast(d["cells"].GetInt()); -- cgit v1.2.1