mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Artifact instances are now owned solely by CMap
This commit is contained in:
@@ -1618,12 +1618,11 @@ void CGameState::attachArmedObjects()
|
||||
|
||||
bool CGameState::giveHeroArtifact(CGHeroInstance * h, const ArtifactID & aid)
|
||||
{
|
||||
CArtifactInstance * ai = ArtifactUtils::createArtifact(aid);
|
||||
map->addNewArtifactInstance(ai);
|
||||
CArtifactInstance * ai = createArtifact(aid);
|
||||
auto slot = ArtifactUtils::getArtAnyPosition(h, aid);
|
||||
if(ArtifactUtils::isSlotEquipment(slot) || ArtifactUtils::isSlotBackpack(slot))
|
||||
{
|
||||
map->putArtifactInstance(*h, ai, slot);
|
||||
map->putArtifactInstance(*h, ai->getId(), slot);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -1766,4 +1765,14 @@ ArtifactID CGameState::pickRandomArtifact(vstd::RNG & rand, int flags)
|
||||
return pickRandomArtifact(rand, flags, [](const ArtifactID &) { return true; });
|
||||
}
|
||||
|
||||
CArtifactInstance * CGameState::createScroll(const SpellID & spellId)
|
||||
{
|
||||
return map->createScroll(spellId);
|
||||
}
|
||||
|
||||
CArtifactInstance * CGameState::createArtifact(const ArtifactID & artID, const SpellID & spellId)
|
||||
{
|
||||
return map->createArtifact(artID, spellId);
|
||||
}
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
||||
Reference in New Issue
Block a user