simplify deck parsing function

This commit is contained in:
Maximilian Keßler 2023-08-05 13:05:29 +02:00
parent 426807f730
commit 95365a8a68
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -64,8 +64,7 @@ namespace Hanabi {
std::vector<Hanabi::Card> parse_deck(const boost::json::value& deck_json) { std::vector<Hanabi::Card> parse_deck(const boost::json::value& deck_json) {
auto deck = boost::json::value_to<std::vector<Hanabi::Card>>(deck_json); auto deck = boost::json::value_to<std::vector<Hanabi::Card>>(deck_json);
for(size_t i = 0; i < deck.size(); i++) { for(auto & card : deck) {
auto &card = deck[i];
assert(card.rank < 5); assert(card.rank < 5);
assert(card.rank >= 0); assert(card.rank >= 0);
assert(card.suit < 6); assert(card.suit < 6);