diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/game/card.h | 4 | ||||
| -rw-r--r-- | src/main/game/game_state.cpp | 2 | ||||
| -rw-r--r-- | src/main/input-output/deal_parser.cpp | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/src/main/game/card.h b/src/main/game/card.h index 9c43350..3a1c6b0 100644 --- a/src/main/game/card.h +++ b/src/main/game/card.h @@ -10,16 +10,18 @@ class card { public: + // Types & typedefs enum class suit_t {Clubs, Diamonds, Hearts, Spades}; enum class colour_t {Black, Red}; typedef uint8_t rank_t; + // Converts a number (0-3) to a suit (Clubs-Spades) static suit_t to_suit(uint8_t); // A card can either be created using two int values (rank & suit), or // using a string (e.g. "AS") card(suit_t, rank_t); - card(const char*); + explicit card(const char*); suit_t get_suit() const; colour_t get_colour() const; diff --git a/src/main/game/game_state.cpp b/src/main/game/game_state.cpp index 14867f8..b45cc11 100644 --- a/src/main/game/game_state.cpp +++ b/src/main/game/game_state.cpp @@ -87,7 +87,7 @@ game_state::game_state(const sol_rules& s_rules, int seed) : // If there is a hole, moves the ace of spades to it if (rules.hole) { deck.erase(find(begin(deck), end(deck), card("AS"))); - piles[hole].place("AS"); + piles[hole].place(card("AS")); } // If there is a stock, deals to it and set up a waste pile too diff --git a/src/main/input-output/deal_parser.cpp b/src/main/input-output/deal_parser.cpp index 8637649..1746603 100644 --- a/src/main/input-output/deal_parser.cpp +++ b/src/main/input-output/deal_parser.cpp @@ -76,7 +76,7 @@ void deal_parser::parse_cells(game_state &gs, const Document& doc) { auto json_card = p.first; assert(json_card->IsString()); - gs.piles[*p.second].place(json_card->GetString()); + gs.piles[*p.second].place(card(json_card->GetString())); } } } |
