mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Merge pull request #353 from liyunfan1223/crash-fix-custom-spell
[Crash fix] Custom cast spell
This commit is contained in:
@@ -9,14 +9,14 @@
|
|||||||
#include "Playerbots.h"
|
#include "Playerbots.h"
|
||||||
#include "ServerFacade.h"
|
#include "ServerFacade.h"
|
||||||
|
|
||||||
uint32 FindLastSeparator(std::string const text, std::string const sep)
|
size_t FindLastSeparator(std::string const text, std::string const sep)
|
||||||
{
|
{
|
||||||
size_t pos = text.rfind(sep);
|
size_t pos = text.rfind(sep);
|
||||||
if (pos == std::string::npos)
|
if (pos == std::string::npos)
|
||||||
return pos;
|
return pos;
|
||||||
|
|
||||||
uint32 lastLinkBegin = text.rfind("|H");
|
size_t lastLinkBegin = text.rfind("|H");
|
||||||
uint32 lastLinkEnd = text.find("|h|r", lastLinkBegin + 1);
|
size_t lastLinkEnd = text.find("|h|r", lastLinkBegin + 1);
|
||||||
if (pos >= lastLinkBegin && pos <= lastLinkEnd)
|
if (pos >= lastLinkBegin && pos <= lastLinkEnd)
|
||||||
pos = text.find_last_of(sep, lastLinkBegin);
|
pos = text.find_last_of(sep, lastLinkBegin);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user