Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::wstring TextMutator::MutateWText(const wchar_t* text)
- {
- const wchar_t* replacements[] =
- {
- L"$COINS$",
- //Добавить новый мутатор сюда
- };
- size_t replacements_count = sizeof(replacements) / sizeof(replacements[0]);
- size_t len = wcslen(text);
- std::wstringstream result_stream;
- result_stream.str().reserve(len);
- for (size_t i = 0; i < len; i++)
- {
- const wchar_t c = text[i];
- if (c == L'$')
- {
- for (size_t j = 0; j < replacements_count; j++)
- if (mutator_cmp(&text[i], replacements[j]))
- {
- result_stream << gData->GetCurrency();
- i += wcslen(replacements[j]) - 1;
- continue;
- }
- }
- result_stream << c;
- }
- return result_stream.str();
- }
Add Comment
Please, Sign In to add comment