diff options
| author | thecharlesblake | 2017-11-14 22:56:52 +0000 |
|---|---|---|
| committer | thecharlesblake | 2017-11-14 22:56:52 +0000 |
| commit | 21a816bd52298ba2b152449472d3be7c7709d296 (patch) | |
| tree | 207f1b9d5e930124fcf88e0d40fd3aa077e1c4ba /src/main | |
| parent | Add benchmark python script (diff) | |
| download | metasol-21a816bd52298ba2b152449472d3be7c7709d296.tar.gz metasol-21a816bd52298ba2b152449472d3be7c7709d296.zip | |
Fix deal bug when no cards in starting tableau
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/game/game_state.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/main/game/game_state.cpp b/src/main/game/game_state.cpp index 3e8d129..1814a41 100644 --- a/src/main/game/game_state.cpp +++ b/src/main/game/game_state.cpp @@ -82,20 +82,19 @@ game_state::game_state(int seed, const sol_rules& s_rules) : } } + // 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()) { card c = deck.back(); deck.pop_back(); - // For the first row we must create all the tableau pile vectors - if (t / rules.tableau_pile_count == 0) { - tableau_piles.push_back(pile::tableau_factory(rules.build_ord)); - } - // Add the randomly generated card to the tableau piles - tableau_piles[t % rules.tableau_pile_count].place(c); - t++; + tableau_piles[t++ % rules.tableau_pile_count].place(c); } // If there are foundation piles, create the relevant pile vectors |
