add card orders to deck
This commit is contained in:
parent
c6a7eec903
commit
8b42819704
2 changed files with 5 additions and 1 deletions
|
@ -63,10 +63,11 @@ namespace Hanabi
|
|||
{
|
||||
suit_t suit;
|
||||
rank_t rank;
|
||||
uint8_t deck_index; /** Order of card in deck, numbered 0, 1, ... */
|
||||
|
||||
// These attributes are not needed in general for a card,
|
||||
// they represent internal states during backtracking.
|
||||
uint8_t local_index;
|
||||
uint8_t local_index; /** Used for the local representation of the current game state. */
|
||||
bool in_starting_hand;
|
||||
bool initial_trash;
|
||||
|
||||
|
|
|
@ -71,12 +71,15 @@ namespace Parsing
|
|||
std::pair<std::vector<Hanabi::Card>, Hanabi::suit_t> parse_deck(const boost::json::value & deck_json)
|
||||
{
|
||||
auto deck = boost::json::value_to<std::vector<Hanabi::Card>>(deck_json);
|
||||
uint8_t deck_index = 0;
|
||||
for (auto & card: deck)
|
||||
{
|
||||
ASSERT(card.rank < 5);
|
||||
ASSERT(card.rank >= 0);
|
||||
ASSERT(card.suit < 6);
|
||||
ASSERT(card.suit >= 0);
|
||||
card.deck_index = deck_index;
|
||||
deck_index++;
|
||||
}
|
||||
Hanabi::suit_t num_suits = 0;
|
||||
for (const auto & card: deck)
|
||||
|
|
Loading…
Reference in a new issue