mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:07:34 +00:00
Solitaire: Iterate the foundation stacks and inline move_card()
Keeping this as a separate commit as I'm not certain whether this is a good change or not. The repeated if-else for each Foundation stack bothered me a bit, though more so before I reduced the code in the {}. But maybe the ifs are clearer than the loop? Doing that also meant I could inline the move_card() code instead of needing to make it a lambda. Again, maybe it would be better as a lambda? I'm still figuring out the style Serenity uses, and I know Andreas is big on expressiveness, and move_card() is more expressive than just having the code in the loop.
This commit is contained in:
parent
4917675529
commit
e0fb36aad7
2 changed files with 23 additions and 31 deletions
|
@ -137,6 +137,7 @@ private:
|
|||
__Count
|
||||
};
|
||||
static constexpr Array piles = { Pile1, Pile2, Pile3, Pile4, Pile5, Pile6, Pile7 };
|
||||
static constexpr Array foundations = { Foundation1, Foundation2, Foundation3, Foundation4 };
|
||||
|
||||
ALWAYS_INLINE const WasteRecycleRules& recycle_rules()
|
||||
{
|
||||
|
@ -161,7 +162,6 @@ private:
|
|||
void remember_move_for_undo(CardStack& from, CardStack& to, NonnullRefPtrVector<Card> moved_cards);
|
||||
void remember_flip_for_undo(Card& card);
|
||||
void update_score(int to_add);
|
||||
void move_card(CardStack& from, CardStack& to);
|
||||
void draw_cards();
|
||||
void pop_waste_to_play_stack();
|
||||
bool attempt_to_move_card_to_foundations(CardStack& from);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue