mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:57:35 +00:00
LibCards+Spider: Move ensure_top_card_is_visible()
logic to CardStack
This commit is contained in:
parent
b26383bc6c
commit
12612703f9
4 changed files with 19 additions and 15 deletions
|
@ -227,6 +227,20 @@ bool CardStack::is_allowed_to_push(Card const& card, size_t stack_size, Movement
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CardStack::make_top_card_visible()
|
||||
{
|
||||
if (is_empty())
|
||||
return false;
|
||||
|
||||
auto& top_card = peek();
|
||||
if (top_card.is_upside_down()) {
|
||||
top_card.set_upside_down(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CardStack::push(NonnullRefPtr<Card> card)
|
||||
{
|
||||
auto top_most_position = m_stack_positions.is_empty() ? m_position : m_stack_positions.last();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue