1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Use MetaString in place of boost::format to avoid exceptions

This commit is contained in:
Ivan Savenko 2023-12-13 16:53:32 +02:00
parent a3adfcf7a7
commit 664da58d4f

View File

@ -16,6 +16,7 @@
#include "../CGeneralTextHandler.h"
#include "../gameState/CGameState.h"
#include "../CPlayerState.h"
#include "../MetaString.h"
VCMI_LIB_NAMESPACE_BEGIN
@ -110,7 +111,12 @@ void CArmedInstance::updateMoraleBonusFromArmy()
else if (!factions.empty()) // no bonus from empty garrison
{
b->val = 2 - static_cast<si32>(factionsInArmy);
description = boost::str(boost::format(VLC->generaltexth->arraytxt[114]) % factionsInArmy % b->val); //Troops of %d alignments %d
MetaString formatter;
formatter.appendTextID("core.arraytxt.114"); //Troops of %d alignments %d
formatter.replaceNumber(factionsInArmy);
formatter.replaceNumber(b->val);
description = formatter.toString();
description = description.substr(0, description.size()-3);//trim value
}