diff options
| author | thecharlesblake | 2017-11-06 16:06:45 +0000 |
|---|---|---|
| committer | thecharlesblake | 2017-11-06 16:06:45 +0000 |
| commit | dfa640b05e1f6bc0c8dcc74ea857159703c10b20 (patch) | |
| tree | 2b0301e9198a6d56afb60055ef6aeb68b466e047 /src/main/game_state.cpp | |
| parent | Add cell printing (diff) | |
| download | metasol-dfa640b05e1f6bc0c8dcc74ea857159703c10b20.tar.gz metasol-dfa640b05e1f6bc0c8dcc74ea857159703c10b20.zip | |
Fixup cell/foundation mixup and printing errs
Diffstat (limited to 'src/main/game_state.cpp')
| -rw-r--r-- | src/main/game_state.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/game_state.cpp b/src/main/game_state.cpp index 90a7381..05bfb4f 100644 --- a/src/main/game_state.cpp +++ b/src/main/game_state.cpp @@ -87,7 +87,7 @@ game_state::game_state(int seed, const sol_rules& s_rules) 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); + cells.push_back(p); } } } @@ -173,6 +173,11 @@ bool game_state::is_solved() const { return false; } } + for (auto p : cells) { + if (!p.empty()) { + return false; + } + } return true; } @@ -214,7 +219,11 @@ void game_state::print_foundations(ostream& stream) const { void game_state::print_cells(ostream& stream) const { for (pile cell : cells) { - if (!cell.empty()) stream << cells[0] << "\t"; + if (cells.empty()) { + stream << "[]" << "\t"; + } else { + stream << cells[0] << "\t"; + } } stream << "\n"; } |
