本文整理汇总了C++中Being::setGuildName方法的典型用法代码示例。如果您正苦于以下问题:C++ Being::setGuildName方法的具体用法?C++ Being::setGuildName怎么用?C++ Being::setGuildName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Being
的用法示例。
在下文中一共展示了Being::setGuildName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
bool GuildManager::process(std::string msg)
{
if (msg.size() > 4 && msg[0] == '#' && msg[1] == '#')
msg = msg.substr(3);
bool haveNick = (msg.find(": ") != std::string::npos);
if (!haveNick && findCutLast(msg, " is now Offline."))
{
Guild *guild = createGuild();
if (!guild)
return false;
if (msg.size() < 4)
return false;
if (msg[0] == '#' && msg[1] == '#')
msg = msg.substr(3);
GuildMember *m = guild->addMember(msg);
if (m)
m->setOnline(false);
guild->sort();
mRequest = false;
return true;
}
else if (!haveNick && findCutLast(msg, " is now Online."))
{
Guild *guild = createGuild();
if (!guild)
return false;
if (msg.size() < 4)
return false;
if (msg[0] == '#' && msg[1] == '#')
msg = msg.substr(3);
GuildMember *m = guild->addMember(msg);
if (m)
m->setOnline(true);
guild->sort();
mRequest = false;
return true;
}
else if (findCutFirst(msg, "Welcome to the "))
{
Guild *guild = createGuild();
if (!guild)
return false;
// logger->log("welcome message: %s", msg.c_str());
size_t pos = msg.find("! (");
if (pos == std::string::npos)
return false;
msg = msg.substr(0, pos);
guild->setName(msg);
if (player_node)
player_node->setGuildName(msg);
mGotName = true;
mSentNameRequest = false;
mRequest = false;
return true;
}
else if (findCutFirst(msg, "Player name: "))
{
Guild *guild = createGuild();
if (!guild)
return false;
size_t pos = msg.find("Access Level: ");
if (pos == std::string::npos)
return false;
msg = msg.substr(pos);
if (!findCutFirst(msg, "Access Level: "))
return false;
pos = msg.find(", Guild:");
if (pos == std::string::npos)
return false;
int level = atoi(msg.substr(0, pos).c_str());
if (level >= 10)
mHavePower = true;
else
mHavePower = false;
msg = msg.substr(pos + strlen(", Guild:"));
pos = msg.find(", No. Of Online Players: ");
if (pos == std::string::npos)
return false;
msg = msg.substr(0, pos);
// logger->log("guild name: %s", msg.c_str());
guild->setName(msg);
if (player_node)
player_node->setGuildName(msg);
mGotName = true;
mSentNameRequest = false;
mRequest = false;
return true;
}
else if (findCutFirst(msg, "OL#"))
{
// logger->log("OL");
//.........这里部分代码省略.........