1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Fused identical artifacts

This commit is contained in:
SoundSSGood
2024-10-12 21:20:29 +03:00
parent d4d3ddf685
commit 86d5c05ffa
9 changed files with 72 additions and 53 deletions

View File

@@ -268,11 +268,17 @@ void CArtifactsOfHeroBase::setSlotData(ArtPlacePtr artPlace, const ArtifactPosit
std::map<const ArtifactID, std::vector<ArtifactID>> arts;
for(const auto combinedArt : slotInfo->artifact->artType->getPartOf())
{
arts.try_emplace(combinedArt->getId(), std::vector<ArtifactID>{});
assert(combinedArt->isCombined());
arts.try_emplace(combinedArt->getId());
CArtifactFittingSet fittingSet(*curHero);
for(const auto part : combinedArt->getConstituents())
{
if(curHero->hasArt(part->getId(), false, false))
const auto partSlot = fittingSet.getArtPos(part->getId(), false, false);
if(partSlot != ArtifactPosition::PRE_FIRST)
{
arts.at(combinedArt->getId()).emplace_back(part->getId());
fittingSet.lockSlot(partSlot);
}
}
}
artPlace->addCombinedArtInfo(arts);