1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Fix crash on artifact movement

This commit is contained in:
Ivan Savenko 2023-11-20 19:56:55 +02:00
parent 845a259619
commit 71825fcc4e

View File

@ -329,7 +329,6 @@ void CGHeroInstance::initHero(CRandomGenerator & rand)
if(!getArt(ArtifactPosition::SPELLBOOK) && type->haveSpellBook) if(!getArt(ArtifactPosition::SPELLBOOK) && type->haveSpellBook)
{ {
auto artifact = ArtifactUtils::createNewArtifactInstance(ArtifactID::SPELLBOOK); auto artifact = ArtifactUtils::createNewArtifactInstance(ArtifactID::SPELLBOOK);
cb->gameState()->map->addNewArtifactInstance(artifact);
putArtifact(ArtifactPosition::SPELLBOOK, artifact); putArtifact(ArtifactPosition::SPELLBOOK, artifact);
} }
} }
@ -339,7 +338,6 @@ void CGHeroInstance::initHero(CRandomGenerator & rand)
if(!getArt(ArtifactPosition::MACH4)) if(!getArt(ArtifactPosition::MACH4))
{ {
auto artifact = ArtifactUtils::createNewArtifactInstance(ArtifactID::CATAPULT); auto artifact = ArtifactUtils::createNewArtifactInstance(ArtifactID::CATAPULT);
cb->gameState()->map->addNewArtifactInstance(artifact);
putArtifact(ArtifactPosition::MACH4, artifact); //everyone has a catapult putArtifact(ArtifactPosition::MACH4, artifact); //everyone has a catapult
} }
@ -458,7 +456,6 @@ void CGHeroInstance::initArmy(CRandomGenerator & rand, IArmyDescriptor * dst)
if(!getArt(slot)) if(!getArt(slot))
{ {
auto artifact = ArtifactUtils::createNewArtifactInstance(aid); auto artifact = ArtifactUtils::createNewArtifactInstance(aid);
cb->gameState()->map->addNewArtifactInstance(artifact);
putArtifact(slot, artifact); putArtifact(slot, artifact);
} }
else else