diff options
| author | thecharlesblake | 2018-02-01 12:58:32 +0000 |
|---|---|---|
| committer | thecharlesblake | 2018-02-01 12:58:32 +0000 |
| commit | 712d6b4bde9016b9b8fa45e3c82c364255965d92 (patch) | |
| tree | 55d33b55ad75770aa6b1616113f189ec3aa8d2f5 /src | |
| parent | Add default constructor for card & 'divider' card (diff) | |
| download | metasol-712d6b4bde9016b9b8fa45e3c82c364255965d92.tar.gz metasol-712d6b4bde9016b9b8fa45e3c82c364255965d92.zip | |
Change pile comp ops to assess size first
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/game/pile.cpp | 24 | ||||
| -rw-r--r-- | src/main/game/pile.h | 1 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/main/game/pile.cpp b/src/main/game/pile.cpp index 6d52335..367f7a0 100644 --- a/src/main/game/pile.cpp +++ b/src/main/game/pile.cpp @@ -52,17 +52,33 @@ bool operator==(const pile& a, const pile& b) { } bool operator<(const pile& a, const pile& b) { - return a.pile_vec < b.pile_vec; + if (a.size() == b.size()) { + return a.pile_vec < b.pile_vec; + } else { + return a.size() < b.size(); + } } bool operator>(const pile& a, const pile& b) { - return a.pile_vec > b.pile_vec; + if (a.size() == b.size()) { + return a.pile_vec > b.pile_vec; + } else { + return a.size() > b.size(); + } } bool operator<=(const pile& a, const pile& b) { - return a.pile_vec <= b.pile_vec; + if (a.size() == b.size()) { + return a.pile_vec <= b.pile_vec; + } else { + return a.size() <= b.size(); + } } bool operator>=(const pile& a, const pile& b) { - return a.pile_vec >= b.pile_vec; + if (a.size() == b.size()) { + return a.pile_vec >= b.pile_vec; + } else { + return a.size() >= b.size(); + } } diff --git a/src/main/game/pile.h b/src/main/game/pile.h index 4256b02..7257738 100644 --- a/src/main/game/pile.h +++ b/src/main/game/pile.h @@ -14,6 +14,7 @@ class pile { friend class hasher; friend class game_state; + friend class cached_game_state; public: typedef uint8_t size_type; |
