diff options
| author | thecharlesblake | 2018-01-27 00:14:42 +0000 |
|---|---|---|
| committer | thecharlesblake | 2018-01-27 00:14:42 +0000 |
| commit | 9ae4c039b998943dbe771772ee06dfbcad3d6b8a (patch) | |
| tree | af4a7f84a7d8945cb9e679f9111a3c11de73190d /src/main/game/game_state.cpp | |
| parent | Fix simple hash bug (diff) | |
| download | metasol-9ae4c039b998943dbe771772ee06dfbcad3d6b8a.tar.gz metasol-9ae4c039b998943dbe771772ee06dfbcad3d6b8a.zip | |
Alter printing to work when pile refs are changed
Diffstat (limited to 'src/main/game/game_state.cpp')
| -rw-r--r-- | src/main/game/game_state.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/game/game_state.cpp b/src/main/game/game_state.cpp index 8f45a38..bcab777 100644 --- a/src/main/game/game_state.cpp +++ b/src/main/game/game_state.cpp @@ -48,6 +48,7 @@ game_state::game_state(const sol_rules& s_rules) : rules(s_rules) { for (uint8_t i = 0; i < rules.cells; i++) { piles.emplace_back(); cells.push_back(static_cast<pile_ref>(piles.size() - 1)); + original_cells.push_back(static_cast<pile_ref>(piles.size() - 1)); } } @@ -70,6 +71,7 @@ game_state::game_state(const sol_rules& s_rules) : rules(s_rules) { for (uint8_t i = 0; i < pile_count; i++) { piles.emplace_back(); reserve.push_back(static_cast<pile_ref>(piles.size() - 1)); + original_reserve.push_back(static_cast<pile_ref>(piles.size() - 1)); } } @@ -77,6 +79,7 @@ game_state::game_state(const sol_rules& s_rules) : rules(s_rules) { for (uint8_t i = 0; i < rules.tableau_pile_count; i++) { piles.emplace_back(); tableau_piles.push_back(static_cast<pile_ref>(piles.size() - 1)); + original_tableau_piles.push_back(static_cast<pile_ref>(piles.size() - 1)); } } @@ -210,8 +213,8 @@ void game_state::make_move(const move m) { // Handles special stock-to-tableau-piles move if (rules.stock_deal_t == sdt::TABLEAU_PILES && m.from == stock) { - for (pile_ref tab_pr = tableau_piles.front(); - tab_pr < tableau_piles.front() + m.count; + for (pile_ref tab_pr = original_tableau_piles.front(); + tab_pr < original_tableau_piles.front() + m.count; tab_pr++) { piles[tab_pr].place(piles[stock].take()); } @@ -239,8 +242,8 @@ void game_state::undo_move(const move m) { // Handles special stock-to-tableau-piles move if (rules.stock_deal_t == sdt::TABLEAU_PILES && m.from == stock) { - for (pile_ref tab_pr = tableau_piles.front() + m.count; - tab_pr-- > tableau_piles.front(); + for (pile_ref tab_pr = original_tableau_piles.front() + m.count; + tab_pr-- > original_tableau_piles.front(); ) { piles[stock].place(piles[tab_pr].take()); } |
