summaryrefslogtreecommitdiff
path: root/Userland/Games/Solitaire/Game.h
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Games/Solitaire/Game.h')
-rw-r--r--Userland/Games/Solitaire/Game.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/Userland/Games/Solitaire/Game.h b/Userland/Games/Solitaire/Game.h
index 72d1ed78df..b9164610ba 100644
--- a/Userland/Games/Solitaire/Game.h
+++ b/Userland/Games/Solitaire/Game.h
@@ -6,6 +6,7 @@
#pragma once
+#include <AK/Array.h>
#include <LibCards/CardStack.h>
#include <LibGUI/Frame.h>
#include <LibGUI/Painter.h>
@@ -97,6 +98,11 @@ private:
bool m_dirty { false };
};
+ struct WasteRecycleRules {
+ uint8_t passes_allowed_before_punishment { 0 };
+ int8_t punishment { 0 };
+ };
+
enum StackLocation {
Stock,
Waste,
@@ -116,6 +122,23 @@ private:
};
static constexpr Array piles = { Pile1, Pile2, Pile3, Pile4, Pile5, Pile6, Pile7 };
+ ALWAYS_INLINE const WasteRecycleRules& recycle_rules()
+ {
+ static constexpr Array<WasteRecycleRules, 2> rules { {
+ { 0, -100 },
+ { 2, -20 },
+ } };
+
+ switch (m_mode) {
+ case Mode::SingleCardDraw:
+ return rules[0];
+ case Mode::ThreeCardDraw:
+ return rules[1];
+ default:
+ VERIFY_NOT_REACHED();
+ }
+ }
+
void mark_intersecting_stacks_dirty(Card& intersecting_card);
void update_score(int to_add);
void move_card(CardStack& from, CardStack& to);
@@ -156,6 +179,7 @@ private:
uint8_t m_new_game_animation_delay { 0 };
uint32_t m_score { 0 };
+ uint8_t m_passes_left_before_punishment { 0 };
};
}