From ed8dda2ff996a76a5a31ac9e760435071e347834 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Sun, 31 Dec 2017 11:47:27 +0000 Subject: Pile efficient implementation fix --- src/main/game/pile.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main/game/pile.cpp') 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(); -- cgit v1.2.1