diff options
Diffstat (limited to 'src/main/game')
| -rw-r--r-- | src/main/game/pile.cpp | 7 | ||||
| -rw-r--r-- | src/main/game/pile.h | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/main/game/pile.cpp b/src/main/game/pile.cpp index 28eb0a8..641174e 100644 --- a/src/main/game/pile.cpp +++ b/src/main/game/pile.cpp @@ -73,14 +73,19 @@ bool pile::can_place(const card c) const { card top_c = top_card(); - // Check suit + // Checks violation of same suit policy if (build_policy == pol::SAME_SUIT && c.get_suit() != top_c.get_suit()) { return false; } + // Checks violation of specific suit policy if (sol_rules::is_suit(build_policy) && c.get_suit() != sol_rules::suit_val(build_policy)) { return false; } + // Checks violation of red-black suit policy + if (build_policy == pol::RED_BLACK && c.get_colour() == top_c.get_colour()) { + return false; + } int tc_r = top_c.get_rank(); int comp_r = c.get_rank(); diff --git a/src/main/game/pile.h b/src/main/game/pile.h index 853caf3..978e32e 100644 --- a/src/main/game/pile.h +++ b/src/main/game/pile.h @@ -55,8 +55,8 @@ private: const sol_rules::build_order build_order; const sol_rules::build_policy build_policy; const bool removable; - const int max_rank; const bool build_order_loops; + const int max_rank; // Underlying vector std::vector<card> pile_vec; |
