diff options
| author | thecharlesblake | 2018-01-02 11:29:16 +0000 |
|---|---|---|
| committer | thecharlesblake | 2018-01-02 11:29:16 +0000 |
| commit | f56486a83a03ab58fd3f455258de4caebe239322 (patch) | |
| tree | 06e2fe80581ed8c9daa471fc8a65ed7dd72c0be3 /src/main/game/pile.cpp | |
| parent | Add rules parsing for bakers dozen (diff) | |
| download | metasol-f56486a83a03ab58fd3f455258de4caebe239322.tar.gz metasol-f56486a83a03ab58fd3f455258de4caebe239322.zip | |
Add empty pile logic for bakers dozen
Diffstat (limited to 'src/main/game/pile.cpp')
| -rw-r--r-- | src/main/game/pile.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/game/pile.cpp b/src/main/game/pile.cpp index 641174e..2b97591 100644 --- a/src/main/game/pile.cpp +++ b/src/main/game/pile.cpp @@ -14,13 +14,14 @@ using namespace boost; typedef sol_rules::build_order ord; typedef sol_rules::build_policy pol; +typedef sol_rules::spaces_policy s_pol; //////////// // Static // //////////// -pile pile::tableau_factory(ord o, pol p) { - return pile(o, p); +pile pile::tableau_factory(ord o, pol p, s_pol sp) { + return pile(o, p, sp); } pile pile::cell_factory() { return pile(ord::SINGLE_CARD, pol::N_A); @@ -38,16 +39,17 @@ pile pile::foundation_factory(pol p) { return pile(ord::ASCENDING, p); } pile pile::hole_factory(int max_rank) { - return pile(ord::BOTH, pol::ANY_SUIT, false, true, max_rank); + return pile(ord::BOTH, pol::ANY_SUIT, s_pol::ANY, false, true, max_rank); } //////////////// // Non-static // //////////////// -pile::pile(ord bo, pol bp, bool r, bool l, int mr) : +pile::pile(ord bo, pol bp, s_pol sp, bool r, bool l, int mr) : build_order(bo), build_policy(bp), + spaces_policy(sp), removable(r), build_order_loops(l), max_rank(mr) { @@ -63,6 +65,9 @@ bool pile::can_place(const card c) const { } if (empty()) { + if (spaces_policy == s_pol::NO_BUILD) { + return false; + } if (sol_rules::is_suit(build_policy)) { return c.get_suit() == sol_rules::suit_val(build_policy) && c.get_rank() == 1; |
