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

@@ -40,7 +40,7 @@ std::string CGCreature::getHoverText(PlayerColor player) const
else
ms.appendLocalString(EMetaText::ARRAY_TXT, quantityTextIndex);
ms.appendRawString(" ");
ms.appendLocalString(EMetaText::CRE_PL_NAMES, getCreature());
ms.appendNamePlural(getCreature());
return ms.toString();
}
@@ -52,7 +52,7 @@ std::string CGCreature::getHoverText(const CGHeroInstance * hero) const
MetaString ms;
ms.appendNumber(stacks.begin()->second->count);
ms.appendRawString(" ");
ms.appendLocalString(EMetaText::CRE_PL_NAMES, getCreature());
ms.appendName(getCreature(), stacks.begin()->second->count);
return ms.toString();
}
else
@@ -159,7 +159,7 @@ void CGCreature::onHeroVisit( const CGHeroInstance * h ) const
BlockingDialog ynd(true,false);
ynd.player = h->tempOwner;
ynd.text.appendLocalString(EMetaText::ADVOB_TXT, 86);
ynd.text.replaceLocalString(EMetaText::CRE_PL_NAMES, getCreature());
ynd.text.replaceName(getCreature(), getStackCount(SlotID(0)));
cb->showBlockingDialog(&ynd);
break;
}
@@ -468,7 +468,7 @@ void CGCreature::flee( const CGHeroInstance * h ) const
BlockingDialog ynd(true,false);
ynd.player = h->tempOwner;
ynd.text.appendLocalString(EMetaText::ADVOB_TXT,91);
ynd.text.replaceLocalString(EMetaText::CRE_PL_NAMES, getCreature());
ynd.text.replaceName(getCreature(), getStackCount(SlotID(0)));
cb->showBlockingDialog(&ynd);
}