diff options
| author | Charlie Blake | 2018-07-14 22:08:10 +0100 |
|---|---|---|
| committer | Charlie Blake | 2018-07-14 22:08:10 +0100 |
| commit | 506a17e822c0364cf440b3d8eb22dad0038ea1ca (patch) | |
| tree | c262537de30ec588614b1cfec8787615b84d51e6 /src/main/game/search-state | |
| parent | Add rules fields for accordion (diff) | |
| download | metasol-506a17e822c0364cf440b3d8eb22dad0038ea1ca.tar.gz metasol-506a17e822c0364cf440b3d8eb22dad0038ea1ca.zip | |
Add random gen and state print for accordion
Diffstat (limited to 'src/main/game/search-state')
| -rw-r--r-- | src/main/game/search-state/game_state.cpp | 17 | ||||
| -rw-r--r-- | src/main/game/search-state/game_state.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/main/game/search-state/game_state.cpp b/src/main/game/search-state/game_state.cpp index b61be3b..b1a8e5e 100644 --- a/src/main/game/search-state/game_state.cpp +++ b/src/main/game/search-state/game_state.cpp @@ -98,6 +98,15 @@ game_state::game_state(const sol_rules& s_rules, streamliner_options stream_opts } } + // If there is a reserve, creates piles + if (rules.accordion_size > 0) { + uint8_t pile_count = rules.accordion_size; + for (uint8_t i = 0; i < pile_count; i++) { + piles.emplace_back(); + accordion.push_back(static_cast<pile::ref>(piles.size() - 1)); + } + } + // Creates the tableau piles for (uint8_t i = 0; i < rules.tableau_pile_count; i++) { piles.emplace_back(); @@ -173,6 +182,14 @@ game_state::game_state(const sol_rules& s_rules, int seed, streamliner_options s } } + // Deals to the accordion + if (rules.accordion_size > 0) { + for (unsigned int i = 0; i < rules.accordion_size; i++) { + place_card(accordion[i], deck.back()); + deck.pop_back(); + } + } + // This only occurs during testing if (rules.tableau_pile_count == 0) return; diff --git a/src/main/game/search-state/game_state.h b/src/main/game/search-state/game_state.h index 05f6974..212229c 100644 --- a/src/main/game/search-state/game_state.h +++ b/src/main/game/search-state/game_state.h @@ -140,6 +140,7 @@ private: std::list<pile::ref> reserve; std::vector<pile::ref> foundations; std::vector<pile::ref> sequences; + std::vector<pile::ref> accordion; pile::ref hole; /* Pile references of starting/original layout */ |
