From 067152f57ced18c5f706144909345125754e8664 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Mon, 8 Jan 2018 19:02:36 +0000 Subject: Add game logic for built pile (AA) and refactor --- src/main/game/pile.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/main/game/pile.cpp') 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(pile_vec.size()); } -card& pile::operator[] (vector::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::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; } -- cgit v1.2.1