From 84bb946e051a779c09d21f1b7961ad2de5926c23 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Tue, 12 Mar 2024 19:38:01 -0700 Subject: [PATCH] fix error message for bad entry in trap card list --- src/ServerState.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ServerState.cc b/src/ServerState.cc index 2d507474..87befe6b 100644 --- a/src/ServerState.cc +++ b/src/ServerState.cc @@ -1140,14 +1140,15 @@ void ServerState::load_config_late() { for (size_t trap_type = 0; trap_type < 5; trap_type++) { auto& trap_card_ids = this->ep3_trap_card_ids[trap_type]; for (const auto& card_it : ep3_trap_cards_json.at(trap_type)->as_list()) { + const string& card_name = card_it->as_string(); try { - const auto& card = this->ep3_card_index->definition_for_name_normalized(card_it->as_string()); + const auto& card = this->ep3_card_index->definition_for_name_normalized(card_name); if (card->def.type != Episode3::CardType::ASSIST) { - throw runtime_error(string_printf("Ep3 card \"%s\" in trap card list is not an assist card", name.c_str())); + throw runtime_error(string_printf("Ep3 card \"%s\" in trap card list is not an assist card", card_name.c_str())); } trap_card_ids.emplace_back(card->def.card_id); } catch (const out_of_range&) { - throw runtime_error(string_printf("Ep3 card \"%s\" in trap card list does not exist", name.c_str())); + throw runtime_error(string_printf("Ep3 card \"%s\" in trap card list does not exist", card_name.c_str())); } } }