1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-15 11:46:56 +02:00

Merge pull request #5143 from IvanSavenko/junkman_fix

Remove MetaString method that can't be used with modded objects
This commit is contained in:
Ivan Savenko 2024-12-25 13:42:44 +02:00 committed by GitHub
commit 8cde4f1434
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 3 additions and 9 deletions

View File

@ -217,7 +217,7 @@ void CGDwelling::onHeroVisit( const CGHeroInstance * h ) const
iw.type = EInfoWindowMode::AUTO; iw.type = EInfoWindowMode::AUTO;
iw.player = h->tempOwner; iw.player = h->tempOwner;
iw.text.appendLocalString(EMetaText::ADVOB_TXT, 44); //{%s} \n\n The camp is deserted. Perhaps you should try next week. iw.text.appendLocalString(EMetaText::ADVOB_TXT, 44); //{%s} \n\n The camp is deserted. Perhaps you should try next week.
iw.text.replaceName(ID); iw.text.replaceName(ID, subID);
cb->sendAndApply(iw); cb->sendAndApply(iw);
return; return;
} }
@ -260,7 +260,7 @@ void CGDwelling::onHeroVisit( const CGHeroInstance * h ) const
else if(ID == Obj::REFUGEE_CAMP) else if(ID == Obj::REFUGEE_CAMP)
{ {
bd.text.appendLocalString(EMetaText::ADVOB_TXT, 35); //{%s} Would you like to recruit %s? bd.text.appendLocalString(EMetaText::ADVOB_TXT, 35); //{%s} Would you like to recruit %s?
bd.text.replaceName(ID); bd.text.replaceName(ID, subID);
for(const auto & elem : creatures) for(const auto & elem : creatures)
bd.text.replaceNamePlural(elem.second[0]); bd.text.replaceNamePlural(elem.second[0]);
} }

View File

@ -45,7 +45,7 @@ std::string CGMarket::getPopupText(PlayerColor player) const
return getHoverText(player); return getHoverText(player);
MetaString message = MetaString::createFromRawString("{%s}\r\n\r\n%s"); MetaString message = MetaString::createFromRawString("{%s}\r\n\r\n%s");
message.replaceName(ID); message.replaceName(ID, subID);
message.replaceTextID(TextIdentifier(getObjectHandler()->getBaseTextID(), "description").get()); message.replaceTextID(TextIdentifier(getObjectHandler()->getBaseTextID(), "description").get());
return message.toString(); return message.toString();
} }

View File

@ -393,11 +393,6 @@ void MetaString::replaceName(const FactionID & id)
replaceTextID(id.toEntity(VLC)->getNameTextID()); replaceTextID(id.toEntity(VLC)->getNameTextID());
} }
void MetaString::replaceName(const MapObjectID & id)
{
replaceTextID(VLC->objtypeh->getObjectName(id, 0));
}
void MetaString::replaceName(const MapObjectID & id, const MapObjectSubID & subId) void MetaString::replaceName(const MapObjectID & id, const MapObjectSubID & subId)
{ {
replaceTextID(VLC->objtypeh->getObjectName(id, subId)); replaceTextID(VLC->objtypeh->getObjectName(id, subId));

View File

@ -99,7 +99,6 @@ public:
void replaceName(const ArtifactID & id); void replaceName(const ArtifactID & id);
void replaceName(const FactionID& id); void replaceName(const FactionID& id);
void replaceName(const MapObjectID & id);
void replaceName(const MapObjectID & id, const MapObjectSubID & subId); void replaceName(const MapObjectID & id, const MapObjectSubID & subId);
void replaceName(const PlayerColor& id); void replaceName(const PlayerColor& id);
void replaceName(const SecondarySkill& id); void replaceName(const SecondarySkill& id);