diff options
Diffstat (limited to 'src/main/game_state.cpp')
| -rw-r--r-- | src/main/game_state.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/game_state.cpp b/src/main/game_state.cpp index 29ccdc3..2dd1ca8 100644 --- a/src/main/game_state.cpp +++ b/src/main/game_state.cpp @@ -55,7 +55,7 @@ game_state::game_state(int seed, const sol_rules& s_rules) hole(false, ord::BOTH, pol::ANY_SUIT, true, rules.max_rank) { vector<card> deck = shuffled_deck(seed, rules.max_rank); - // If there is a hole, move the ace to spades to it + // If there is a hole, move the ace of spades to it if (rules.hole) { deck.erase(find(begin(deck), end(deck), card("AS"))); hole.place("AS"); @@ -82,6 +82,14 @@ game_state::game_state(int seed, const sol_rules& s_rules) foundations.push_back(p); } } + + // If there are cell piles, create the relevant cell vectors + if (rules.cells > 0) { + for (int i = 0; i < rules.cells; i++) { + pile p(true, ord::SINGLE_CARD, pol::ANY_SUIT, false); + foundations.push_back(p); + } + } } // Generate a randomly ordered vector of cards @@ -129,6 +137,10 @@ vector<game_state> game_state::get_next_legal_states() { can_add.push_back(&foundations[i]); } } + for (vector<pile>::size_type i = 0; i < cells.size(); i++) { + can_remove.push_back(&cells[i]); + can_add.push_back(&cells[i]); + } if (rules.hole) { can_add.push_back(&hole); } |
