本文整理汇总了C++中ChatChannel::getUsers方法的典型用法代码示例。如果您正苦于以下问题:C++ ChatChannel::getUsers方法的具体用法?C++ ChatChannel::getUsers怎么用?C++ ChatChannel::getUsers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChatChannel
的用法示例。
在下文中一共展示了ChatChannel::getUsers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parsePacket
//.........这里部分代码省略.........
{
uint32_t playerId = msg.get<uint32_t>();
if(Player* player = g_game.getPlayerByID(playerId))
{
output->put<char>(MP_MSG_USER_DATA);
output->put<uint32_t>(playerId);
output->put<uint32_t>(player->getGroupId());
output->put<uint32_t>(player->getVocationId());
output->put<uint32_t>(player->getLevel());
output->put<uint32_t>(player->getMagicLevel());
// TODO?
}
else
{
output->put<char>(MP_MSG_FAILURE);
output->putString("Player not found");
}
}
case MP_MSG_CHAT_REQUEST:
{
output->put<char>(MP_MSG_CHAT_LIST);
ChannelList list = g_chat.getPublicChannels();
output->put<uint16_t>(list.size());
for(ChannelList::const_iterator it = list.begin(); it != list.end(); ++it)
{
output->put<uint16_t>((*it)->getId());
output->putString((*it)->getName());
output->put<uint16_t>((*it)->getFlags());
output->put<uint16_t>((*it)->getUsers().size());
}
break;
}
case MP_MSG_CHAT_OPEN:
{
ChatChannel* channel = NULL;
uint16_t channelId = msg.get<uint16_t>();
if((channel = g_chat.getChannelById(channelId)) && g_chat.isPublicChannel(channelId))
{
m_channels |= (uint32_t)channelId;
output->put<char>(MP_MSG_CHAT_USERS);
UsersMap users = channel->getUsers();
output->put<uint16_t>(users.size());
for(UsersMap::const_iterator it = users.begin(); it != users.end(); ++it)
output->put<uint32_t>(it->first);
}
else
{
output->put<char>(MP_MSG_FAILURE);
output->putString("Invalid channel");
}
break;
}
case MP_MSG_CHAT_CLOSE:
{
uint16_t channelId = msg.get<uint16_t>();
if(g_chat.getChannelById(channelId) && g_chat.isPublicChannel(channelId))