diff options
-rw-r--r-- | Userland/Games/Solitaire/Game.cpp | 2 | ||||
-rw-r--r-- | Userland/Games/Spider/Game.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCards/CardGame.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibCards/CardGame.h | 2 |
4 files changed, 7 insertions, 5 deletions
diff --git a/Userland/Games/Solitaire/Game.cpp b/Userland/Games/Solitaire/Game.cpp index 1104b6bbe7..e33cb902b9 100644 --- a/Userland/Games/Solitaire/Game.cpp +++ b/Userland/Games/Solitaire/Game.cpp @@ -297,7 +297,7 @@ void Game::mouseup_event(GUI::MouseEvent& event) auto& stack = *target_stack; remember_move_for_undo(*moving_cards_source_stack(), stack, moving_cards()); - drop_cards_on_stack(stack, Cards::CardStack::MovementRule::Alternating); + drop_cards_on_stack(stack, Cards::CardStack::MovementRule::Alternating).release_value_but_fixme_should_propagate_errors(); if (moving_cards_source_stack()->type() == CardStack::Type::Play) pop_waste_to_play_stack(); diff --git a/Userland/Games/Spider/Game.cpp b/Userland/Games/Spider/Game.cpp index d78d63aca2..f4fc5e5276 100644 --- a/Userland/Games/Spider/Game.cpp +++ b/Userland/Games/Spider/Game.cpp @@ -288,7 +288,7 @@ void Game::mousedown_event(GUI::MouseEvent& event) void Game::move_focused_cards(CardStack& stack) { auto card_count = moving_cards().size(); - drop_cards_on_stack(stack, Cards::CardStack::MovementRule::Any); + drop_cards_on_stack(stack, Cards::CardStack::MovementRule::Any).release_value_but_fixme_should_propagate_errors(); bool was_visible = moving_cards_source_stack()->is_empty() || !moving_cards_source_stack()->peek().is_upside_down(); remember_move_for_undo(*moving_cards_source_stack(), stack, card_count, was_visible); update_score(-1); diff --git a/Userland/Libraries/LibCards/CardGame.cpp b/Userland/Libraries/LibCards/CardGame.cpp index ad1a8e6a0b..a863128709 100644 --- a/Userland/Libraries/LibCards/CardGame.cpp +++ b/Userland/Libraries/LibCards/CardGame.cpp @@ -83,17 +83,19 @@ RefPtr<CardStack> CardGame::find_stack_to_drop_on(CardStack::MovementRule moveme return closest_stack; } -void CardGame::drop_cards_on_stack(Cards::CardStack& stack, CardStack::MovementRule movement_rule) +ErrorOr<void> CardGame::drop_cards_on_stack(Cards::CardStack& stack, CardStack::MovementRule movement_rule) { VERIFY(stack.is_allowed_to_push(m_moving_cards.at(0), m_moving_cards.size(), movement_rule)); for (auto& to_intersect : moving_cards()) { mark_intersecting_stacks_dirty(to_intersect); - stack.push(to_intersect).release_value_but_fixme_should_propagate_errors(); + TRY(stack.push(to_intersect)); (void)moving_cards_source_stack()->pop(); } update(moving_cards_source_stack()->bounding_box()); update(stack.bounding_box()); + + return {}; } void CardGame::clear_moving_cards() diff --git a/Userland/Libraries/LibCards/CardGame.h b/Userland/Libraries/LibCards/CardGame.h index d199471fff..d6d60e04c2 100644 --- a/Userland/Libraries/LibCards/CardGame.h +++ b/Userland/Libraries/LibCards/CardGame.h @@ -44,7 +44,7 @@ public: RefPtr<CardStack> moving_cards_source_stack() const { return m_moving_cards_source_stack; } void pick_up_cards_from_stack(CardStack&, Gfx::IntPoint click_location, CardStack::MovementRule); RefPtr<CardStack> find_stack_to_drop_on(CardStack::MovementRule) const; - void drop_cards_on_stack(CardStack&, CardStack::MovementRule); + ErrorOr<void> drop_cards_on_stack(CardStack&, CardStack::MovementRule); void clear_moving_cards(); bool is_previewing_card() const { return !m_previewed_card_stack.is_null(); } |