Last fixes on chat + database incorrect charset

This commit is contained in:
Atidot3
2024-08-01 18:58:41 +02:00
parent 142f2ad212
commit ab4e3c2c45
6 changed files with 58 additions and 39 deletions

View File

@@ -9,7 +9,8 @@ void PlayerbotTextMgr::replaceAll(std::string & str, const std::string & from, c
if (from.empty())
return;
size_t start_pos = 0;
while ((start_pos = str.find(from, start_pos)) != std::string::npos) {
while ((start_pos = str.find(from, start_pos)) != std::string::npos)
{
str.replace(start_pos, from.length(), to);
start_pos += to.length(); // In case 'to' contains 'from', like replacing 'x' with 'yx'
}