From f8931f348ef456d9fac78b5cadad280f81dfcfc6 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Wed, 27 Dec 2017 00:04:32 +0000 Subject: First sp test working --- src/main/game/game_state.cpp | 38 +++++++++++++++++++------------------- src/main/game/sol_rules.cpp | 5 ++--- 2 files changed, 21 insertions(+), 22 deletions(-) (limited to 'src/main/game') diff --git a/src/main/game/game_state.cpp b/src/main/game/game_state.cpp index 01a17fb..b851f2a 100644 --- a/src/main/game/game_state.cpp +++ b/src/main/game/game_state.cpp @@ -28,6 +28,25 @@ game_state::game_state(const sol_rules& s_rules) : stock(pile::stock_factory()), waste(pile::waste_factory()), hole(pile::hole_factory(s_rules.max_rank)) { + + // Creates the tableau piles + for (unsigned int i = 0; i < rules.tableau_pile_count; i++) { + tableau_piles.push_back(pile::tableau_factory(rules.build_ord)); + } + + // If there are foundation piles, create the relevant pile vectors + if (rules.foundations) { + for (int i = 0; i < 4; i++) { + foundations.push_back(pile::foundation_factory(pol(i))); + } + } + + // If there are cell piles, create the relevant cell vectors + if (rules.cells > 0) { + for (unsigned int i = 0; i < rules.cells; i++) { + cells.push_back(pile::cell_factory()); + } + } } // Construct an initial game state from a JSON doc @@ -64,11 +83,6 @@ game_state::game_state(const sol_rules& s_rules, int seed) : } } - // Creates the tableau piles - for (unsigned int i = 0; i < rules.tableau_pile_count; i++) { - tableau_piles.push_back(pile::tableau_factory(rules.build_ord)); - } - // Deal to the tableau piles (row-by-row) unsigned int t = 0; while (!deck.empty()) { @@ -78,20 +92,6 @@ game_state::game_state(const sol_rules& s_rules, int seed) : // Add the randomly generated card to the tableau piles tableau_piles[t++ % rules.tableau_pile_count].place(c); } - - // If there are foundation piles, create the relevant pile vectors - if (rules.foundations) { - for (int i = 0; i < 4; i++) { - foundations.push_back(pile::foundation_factory(pol(i))); - } - } - - // If there are cell piles, create the relevant cell vectors - if (rules.cells > 0) { - for (unsigned int i = 0; i < rules.cells; i++) { - cells.push_back(pile::cell_factory()); - } - } } // Generate a randomly ordered vector of cards diff --git a/src/main/game/sol_rules.cpp b/src/main/game/sol_rules.cpp index 66543de..91b00c1 100644 --- a/src/main/game/sol_rules.cpp +++ b/src/main/game/sol_rules.cpp @@ -5,13 +5,12 @@ #include #include #include -#include #include "rapidjson/error/en.h" -#include "util/util.h" #include "sol_rules.h" -#include "input-output/sol_preset_types.h" +#include "../util/util.h" +#include "../input-output/sol_preset_types.h" using namespace std; using namespace boost; -- cgit v1.2.1