1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

MetaString refactor to eliminate integer usage for identifiers

- entity names are now stored and serialized as text ID's
- added helper methods for convenience to get entities names to
metastring
This commit is contained in:
Ivan Savenko
2023-11-02 22:01:49 +02:00
parent f4feaea177
commit 86a3806bec
22 changed files with 185 additions and 158 deletions

View File

@ -169,7 +169,7 @@ void CGMine::flagMine(const PlayerColor & player) const
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.soundID = soundBase::FLAGMINE;
iw.text.appendLocalString(EMetaText::MINE_EVNTS, producedResource); //not use subID, abandoned mines uses default mine texts
iw.text.appendTextID(TextIdentifier("core.mineevnt", producedResource.getNum()).get()); //not use subID, abandoned mines uses default mine texts
iw.player = player;
iw.components.emplace_back(ComponentType::RESOURCE_PER_DAY, producedResource, producedQuantity);
cb->showInfoDialog(&iw);
@ -820,7 +820,7 @@ void CGArtifact::onHeroVisit(const CGHeroInstance * h) const
if(!message.empty())
iw.text = message;
else
iw.text.appendLocalString(EMetaText::ART_EVNTS, getArtifact());
iw.text.appendTextID(getArtifact().toArtifact()->getEventTextID());
}
break;
case Obj::SPELL_SCROLL:
@ -832,7 +832,7 @@ void CGArtifact::onHeroVisit(const CGHeroInstance * h) const
else
{
iw.text.appendLocalString(EMetaText::ADVOB_TXT,135);
iw.text.replaceLocalString(EMetaText::SPELL_NAME, spell.getNum());
iw.text.replaceName(spell);
}
}
break;