booster shop enhancement

This commit is contained in:
Anthony Calosa
2017-02-24 21:45:43 +08:00
parent 5b96f30b1a
commit df925cfcb0
5 changed files with 46 additions and 11 deletions

View File

@@ -298,16 +298,19 @@ void CardPrimitive::setText(const string& value)
* Instead, we format when requested, but only once, and cache the result.
* To avoid memory to blow up, in exchange of the cached result, we erase the original string
*/
const vector<string>& CardPrimitive::getFormattedText()
const vector<string>& CardPrimitive::getFormattedText(bool noremove)
{
if (!text.size())
return formattedText;
std::string::size_type found = text.find_first_of("{}");
while (found != string::npos)
if(!noremove)
{
text[found] = '/';
found = text.find_first_of("{}", found + 1);
while (found != string::npos)
{
text[found] = '/';
found = text.find_first_of("{}", found + 1);
}
}
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAGIC_FONT);
mFont->FormatText(text, formattedText);