Update to new Throw message.

This commit is contained in:
Deukhoofd 2021-11-21 12:46:30 +01:00
parent 175fc37be9
commit 507cf30097
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
5 changed files with 15 additions and 22884 deletions

22875
extern/json.hpp vendored

File diff suppressed because it is too large Load Diff

View File

@ -60,8 +60,7 @@ namespace PkmnLibAI {
return userIndex;
}
}
THROW("Unknown attack target kind: '" << CreatureLib::Library::AttackTargetHelper::ToString(moveTarget)
<< "'.")
THROW("Unknown attack target kind: '", CreatureLib::Library::AttackTargetHelper::ToString(moveTarget), "'.")
}
};
}

@ -1 +1 @@
Subproject commit d3e95dad61c5ce60db17db905fec4eeb4f65fdce
Subproject commit e2edf6129dd3c2feb44bf5ce98644b26da9609f8

View File

@ -73,12 +73,12 @@ u8 RunBattle(ArbUt::Random& rand, const PkmnLib::Battling::BattleLibrary* librar
if (!battle->TrySetChoice(c1)) {
if (c1->GetKind() == CreatureLib::Battling::TurnChoiceKind::Attack) {
auto a = (CreatureLib::Battling::AttackTurnChoice*)c1;
THROW("Failed to set move choice of move: '"
<< a->GetAttack()->GetAttack()->GetName() << "' targeting side "
<< (i32)a->GetTarget().GetSideIndex() << " and index " << (i32)a->GetTarget().GetCreatureIndex());
THROW("Failed to set move choice of move: '", a->GetAttack()->GetAttack()->GetName(),
"' targeting side ", (i32)a->GetTarget().GetSideIndex(), " and index ",
(i32)a->GetTarget().GetCreatureIndex());
} else {
THROW("Failed to set choice of kind: "
<< CreatureLib::Battling::TurnChoiceKindHelper::ToString(c1->GetKind()));
THROW("Failed to set choice of kind: ",
CreatureLib::Battling::TurnChoiceKindHelper::ToString(c1->GetKind()));
}
}
Ensure(battle->TrySetChoice(c2));

View File

@ -44,7 +44,14 @@ int main(int argc, char** argv) {
if (!workingDirectory.empty()) {
chdir(std::filesystem::path(workingDirectory).c_str());
}
auto battleLib = BuildLibrary::Build("");
PkmnLib::Battling::BattleLibrary* battleLib;
try {
battleLib = BuildLibrary::Build("");
} catch (const ArbUt::Exception& e) {
std::cout << e.what() << std::endl;
return 1;
}
if (battleLib == nullptr) {
return 1;
}