1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:57:35 +00:00

Solitaire: Prevent player dragging entire stack to foundation

Currently, it is possible for the player to drag an entire stack
of cards to the foundation stack, provided the top card of the stack
(i.e the "root" card) can be dropped onto the foundation stack.
This causes an invalid state where, e.g, red cards end up in a
black foundation stack, or vice versa.
This commit is contained in:
Jesse Buhagiar 2021-05-18 21:43:02 +10:00 committed by Andreas Kling
parent a743075b9f
commit 2f49241296
3 changed files with 6 additions and 3 deletions

View file

@ -249,7 +249,7 @@ void Game::mouseup_event(GUI::MouseEvent& event)
for (auto& focused_card : m_focused_cards) {
if (stack.bounding_box().intersects(focused_card.rect())) {
if (stack.is_allowed_to_push(m_focused_cards.at(0))) {
if (stack.is_allowed_to_push(m_focused_cards.at(0), m_focused_cards.size())) {
for (auto& to_intersect : m_focused_cards) {
mark_intersecting_stacks_dirty(to_intersect);
stack.push(to_intersect);