本文整理汇总了C++中LineFromMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ LineFromMessage函数的具体用法?C++ LineFromMessage怎么用?C++ LineFromMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LineFromMessage函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strdup
void ChatHandler::SendGlobalGMSysMessage(const char *str)
{
// Chat output
WorldPacket data;
// need copy to prevent corruption by strtok call in LineFromMessage original string
char* buf = strdup(str);
char* pos = buf;
while (char* line = LineFromMessage(pos))
{
FillSystemMessageData(&data, line);
sWorld->SendGlobalGMMessage(&data);
}
free(buf);
}
示例2: strdup
void ChatHandler::SendSysMessage(const char *str)
{
WorldPackets::Chat::Chat packet;
// need copy to prevent corruption by strtok call in LineFromMessage original string
char* buf = strdup(str);
char* pos = buf;
while (char* line = LineFromMessage(pos))
{
packet.Initalize(CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
m_session->SendPacket(packet.Write());
}
free(buf);
}
示例3: strdup
void ChatHandler::SendSysMessage(const char *str)
{
WorldPacket data;
// need copy to prevent corruption by strtok call in LineFromMessage original string
char* buf = strdup(str);
char* pos = buf;
while (char* line = LineFromMessage(pos))
{
BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, NULL, NULL, line);
m_session->SendPacket(&data);
}
free(buf);
}
示例4: strdup
void ChatHandler::SendGlobalGMSysMessage(const char *str)
{
// Chat output
WorldPacket data;
// need copy to prevent corruption by strtok call in LineFromMessage original string
char* buf = strdup(str);
char* pos = buf;
while (char* line = LineFromMessage(pos))
{
BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
sWorld->SendGlobalGMMessage(&data);
}
free(buf);
}
示例5: while
void ChatHandler::SendSysMessage(const char *str, bool escapeCharacters)
{
WorldPacket data;
// need copy to prevent corruption by strtok call in LineFromMessage original string
char* buf;
char* pos;
if (escapeCharacters && strchr(str, '|'))
{
size_t startPos = 0;
std::ostringstream o;
while (const char* charPos = strchr(str + startPos, '|'))
{
o.write(str + startPos, charPos - str - startPos);
o << "||";
startPos = charPos - str + 1;
}
o.write(str + startPos, strlen(str) - startPos);
buf = strdup(o.str().c_str());
}
else
{
buf = strdup(str);
}
pos = buf;
while (char* line = LineFromMessage(pos))
{
BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, NULL, NULL, line);
m_session->SendPacket(&data);
}
free(buf);
}