1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

LibCards: Combine CardStack constructors

And while I'm at it, clarify the name of `associated_stack` to
`covered_stack`. It's used in exactly one way, so we can make the code
clearer by giving it a less generic name.
This commit is contained in:
Sam Atkins 2022-09-28 12:48:01 +01:00 committed by Sam Atkins
parent bfa9ae809f
commit 21a818ab50
2 changed files with 8 additions and 16 deletions

View file

@ -31,8 +31,7 @@ public:
};
CardStack();
CardStack(Gfx::IntPoint const& position, Type type);
CardStack(Gfx::IntPoint const& position, Type type, NonnullRefPtr<CardStack> associated_stack);
CardStack(Gfx::IntPoint const& position, Type type, RefPtr<CardStack> covered_stack = nullptr);
bool is_empty() const { return m_stack.is_empty(); }
bool is_focused() const { return m_focused; }
@ -83,7 +82,10 @@ private:
void calculate_bounding_box();
RefPtr<CardStack> m_associated_stack;
// An optional stack that this stack is painted on top of.
// eg, in Solitaire the Play stack is positioned over the Waste stack.
RefPtr<CardStack> m_covered_stack;
NonnullRefPtrVector<Card> m_stack;
Vector<Gfx::IntPoint> m_stack_positions;
Gfx::IntPoint m_position;