void Deck::set(const Cards& all_cards, const std::vector<unsigned>& ids, const std::map<signed, char> &marks) { commander = nullptr; strategy = DeckStrategy::random; for(auto id: ids) { const Card* card{all_cards.by_id(id)}; if(card->m_type == CardType::commander) { if(commander == nullptr) { commander = card; } else { throw std::runtime_error("While constructing a deck: two commanders detected (" + card->m_name + " and " + commander->m_name + ")"); } } else { cards.emplace_back(card); } } if(commander == nullptr) { throw std::runtime_error("While constructing a deck: no commander found"); } card_marks = marks; }