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

Converted Component class to use VariantIdentifier instead of int

This commit is contained in:
Ivan Savenko
2023-10-31 11:09:56 +02:00
parent 0376873cb3
commit 10e50548e7
36 changed files with 435 additions and 363 deletions

View File

@ -169,7 +169,7 @@ void CGMine::flagMine(const PlayerColor & player) const
iw.soundID = soundBase::FLAGMINE;
iw.text.appendLocalString(EMetaText::MINE_EVNTS, producedResource); //not use subID, abandoned mines uses default mine texts
iw.player = player;
iw.components.emplace_back(Component::EComponentType::RESOURCE, producedResource, producedQuantity, -1);
iw.components.emplace_back(ComponentType::RESOURCE_PER_DAY, producedResource, producedQuantity);
cb->showInfoDialog(&iw);
}
@ -324,7 +324,7 @@ void CGResource::collectRes(const PlayerColor & player) const
sii.text.appendLocalString(EMetaText::ADVOB_TXT,113);
sii.text.replaceLocalString(EMetaText::RES_NAMES, resourceID());
}
sii.components.emplace_back(Component::EComponentType::RESOURCE, resourceID(), amount, 0);
sii.components.emplace_back(ComponentType::RESOURCE, resourceID(), amount);
sii.soundID = soundBase::pickup01 + CRandomGenerator::getDefault().nextInt(6);
cb->showInfoDialog(&sii);
cb->removeObject(this, player);
@ -666,7 +666,7 @@ void CGWhirlpool::onHeroVisit( const CGHeroInstance * h ) const
iw.type = EInfoWindowMode::AUTO;
iw.player = h->tempOwner;
iw.text.appendLocalString(EMetaText::ADVOB_TXT, 168);
iw.components.emplace_back(CStackBasicDescriptor(h->getCreature(targetstack), -countToTake));
iw.components.emplace_back(ComponentType::CREATURE, h->getCreature(targetstack)->getId(), -countToTake);
cb->showInfoDialog(&iw);
cb->changeStackCount(StackLocation(h, targetstack), -countToTake);
}
@ -790,7 +790,7 @@ void CGArtifact::onHeroVisit(const CGHeroInstance * h) const
{
case Obj::ARTIFACT:
{
iw.components.emplace_back(Component::EComponentType::ARTIFACT, getArtifact(), 0, 0);
iw.components.emplace_back(ComponentType::ARTIFACT, getArtifact());
if(!message.empty())
iw.text = message;
else
@ -800,7 +800,7 @@ void CGArtifact::onHeroVisit(const CGHeroInstance * h) const
case Obj::SPELL_SCROLL:
{
int spellID = storedArtifact->getScrollSpellID();
iw.components.emplace_back(Component::EComponentType::SPELL, spellID, 0, 0);
iw.components.emplace_back(ComponentType::SPELL, spellID);
if(!message.empty())
iw.text = message;
else