1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +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

@@ -187,11 +187,11 @@ void Unit::addText(MetaString & text, EMetaText type, int32_t serial, const boos
void Unit::addNameReplacement(MetaString & text, const boost::logic::tribool & plural) const
{
if(boost::logic::indeterminate(plural))
text.replaceCreatureName(creatureId(), getCount());
text.replaceName(creatureId(), getCount());
else if(plural)
text.replaceLocalString(EMetaText::CRE_PL_NAMES, creatureIndex());
text.replaceName(creatureIndex(), 2);
else
text.replaceLocalString(EMetaText::CRE_SING_NAMES, creatureIndex());
text.replaceName(creatureIndex(), 1);
}
std::string Unit::formatGeneralMessage(const int32_t baseTextId) const
@@ -200,7 +200,7 @@ std::string Unit::formatGeneralMessage(const int32_t baseTextId) const
MetaString text;
text.appendLocalString(EMetaText::GENERAL_TXT, textId);
text.replaceCreatureName(creatureId(), getCount());
text.replaceName(creatureId(), getCount());
return text.toString();
}