aboutsummaryrefslogtreecommitdiff
path: root/src/main/game/pile.h
diff options
context:
space:
mode:
authorthecharlesblake2018-01-30 15:49:28 +0000
committerthecharlesblake2018-01-30 15:49:28 +0000
commit583b9a005ebd447d39c0515e2692178cc1dfe7b9 (patch)
tree0f134d7b22f78543c73d0524db6bd5d64f8fa20b /src/main/game/pile.h
parentUpdate global cache to insert ordered vec (diff)
downloadmetasol-583b9a005ebd447d39c0515e2692178cc1dfe7b9.tar.gz
metasol-583b9a005ebd447d39c0515e2692178cc1dfe7b9.zip

Update card & pile with comp operators for sorting

Diffstat (limited to 'src/main/game/pile.h')
-rw-r--r--src/main/game/pile.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/game/pile.h b/src/main/game/pile.h
index 2bf2d5b..4256b02 100644
--- a/src/main/game/pile.h
+++ b/src/main/game/pile.h
@@ -13,6 +13,7 @@
class pile {
friend class hasher;
+ friend class game_state;
public:
typedef uint8_t size_type;
@@ -25,16 +26,20 @@ public:
bool empty() const;
size_type size() const;
- // Modify
- void place(card);
- card take();
-
// Indexes the vector, with the top card as index 0
card& operator[] (size_type);
card operator[] (size_type) const;
friend bool operator==(const pile&, const pile&);
+ friend bool operator<(const pile&, const pile&);
+ friend bool operator>(const pile&, const pile&);
+ friend bool operator<=(const pile&, const pile&);
+ friend bool operator>=(const pile&, const pile&);
private:
+ // Modify
+ void place(card);
+ card take();
+
// Underlying vector
std::vector<card> pile_vec;
};