1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

CMap put move and remove artifact method

This commit is contained in:
SoundSSGood
2024-09-06 17:59:40 +03:00
parent 92c5fd4156
commit b9ae7f1138
19 changed files with 84 additions and 90 deletions

View File

@@ -772,9 +772,8 @@ void CGArtifact::initObj(vstd::RNG & rand)
{
if (!storedArtifact)
{
auto * a = new CArtifactInstance();
cb->gameState()->map->addNewArtifactInstance(a);
storedArtifact = a;
storedArtifact = ArtifactUtils::createArtifact(ArtifactID());
cb->gameState()->map->addNewArtifactInstance(storedArtifact);
}
if(!storedArtifact->artType)
storedArtifact->setType(getArtifact().toArtifact());
@@ -901,7 +900,7 @@ void CGArtifact::onHeroVisit(const CGHeroInstance * h) const
void CGArtifact::pick(const CGHeroInstance * h) const
{
if(cb->putArtifact(ArtifactLocation(h->id, ArtifactPosition::FIRST_AVAILABLE), storedArtifact))
if(cb->putArtifact(ArtifactLocation(h->id, ArtifactPosition::FIRST_AVAILABLE), storedArtifact->getId()))
cb->removeObject(this, h->getOwner());
}