1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-05-13 22:06:58 +02:00

Add more descriptive error messages

This commit is contained in:
Ivan Savenko 2024-05-16 07:55:11 +00:00
parent ff0d5d63d9
commit f963b827e9

View File

@ -392,9 +392,15 @@ void CGameStateCampaign::transferMissingArtifacts(const CampaignTravel & travelO
auto * donorHero = campaignHeroReplacement.hero;
if (!donorHero)
throw std::runtime_error("Failed to find hero to take artifacts from! Scenario: " + gameState->map->name.toString());
for (auto const & artLocation : campaignHeroReplacement.transferrableArtifacts)
{
auto * artifact = donorHero->getArt(artLocation);
if (!donorHero)
throw std::runtime_error("Failed to find artifacts to transfer to travelling hero! Scenario: " + gameState->map->name.toString());
artifact->removeFrom(*donorHero, artLocation);
if (receiver)