diff options
| author | thecharlesblake | 2018-01-08 19:02:36 +0000 |
|---|---|---|
| committer | thecharlesblake | 2018-01-08 19:02:36 +0000 |
| commit | 067152f57ced18c5f706144909345125754e8664 (patch) | |
| tree | cd893ea4ec1754c64f5a2b0c20d41d7d4d104988 /src/main/game/pile.cpp | |
| parent | Add game setup for built pile (AS) (diff) | |
| download | metasol-067152f57ced18c5f706144909345125754e8664.tar.gz metasol-067152f57ced18c5f706144909345125754e8664.zip | |
Add game logic for built pile (AA) and refactor
Diffstat (limited to 'src/main/game/pile.cpp')
| -rw-r--r-- | src/main/game/pile.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/main/game/pile.cpp b/src/main/game/pile.cpp index 3b53950..264bb49 100644 --- a/src/main/game/pile.cpp +++ b/src/main/game/pile.cpp @@ -21,15 +21,16 @@ bool pile::empty() const { return pile_vec.empty(); } -uint8_t pile::size() const { +pile::size_type pile::size() const { return static_cast<uint8_t>(pile_vec.size()); } -card& pile::operator[] (vector<card>::size_type i) { - return pile_vec[i]; +card& pile::operator[] (size_type i) { + return pile_vec[pile_vec.size() - 1 - i]; } -card pile::operator[] (vector<card>::size_type i) const { - return pile_vec[i]; + +card pile::operator[] (size_type i) const { + return pile_vec[pile_vec.size() - 1 - i]; } void pile::place(const card c) { @@ -42,10 +43,6 @@ card pile::take() { return c; } -void pile::clear() { - pile_vec.clear(); -} - bool operator==(const pile& a, const pile& b) { return a.pile_vec == b.pile_vec; } |
