本文整理汇总了C++中PrivateChatChannel::setOwner方法的典型用法代码示例。如果您正苦于以下问题:C++ PrivateChatChannel::setOwner方法的具体用法?C++ PrivateChatChannel::setOwner怎么用?C++ PrivateChatChannel::setOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PrivateChatChannel
的用法示例。
在下文中一共展示了PrivateChatChannel::setOwner方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createChannel
ChatChannel* Chat::createChannel(Player* player, uint16_t channelId)
{
if(!player || player->isRemoved() || getChannel(player, channelId))
return NULL;
switch(channelId)
{
case CHANNEL_GUILD:
{
ChatChannel* newChannel = NULL;
if((newChannel = new ChatChannel(channelId, player->getGuildName(), ChatChannel::staticFlags)))
m_guildChannels[player->getGuildId()] = newChannel;
return newChannel;
}
case CHANNEL_PARTY:
{
ChatChannel* newChannel = NULL;
if(player->getParty() && (newChannel = new ChatChannel(channelId, partyName, ChatChannel::staticFlags)))
m_partyChannels[player->getParty()] = newChannel;
return newChannel;
}
case CHANNEL_PRIVATE:
{
//only 1 private channel for each premium player
if(!player->isPremium() || getPrivateChannel(player))
return NULL;
//find a free private channel slot
for(uint16_t i = 100; i < 10000; ++i)
{
if(m_privateChannels.find(i) != m_privateChannels.end())
continue;
uint16_t flags = 0;
if(dummyPrivate)
flags = dummyPrivate->getFlags();
PrivateChatChannel* newChannel = NULL;
if((newChannel = new PrivateChatChannel(i, player->getName() + "'s Channel", flags)))
{
newChannel->setOwner(player->getGUID());
m_privateChannels[i] = newChannel;
}
return newChannel;
}
}
default:
break;
}
return NULL;
}
示例2: createChannel
ChatChannel* Chat::createChannel(Player* player, const uint16_t& channelId)
{
if (getChannel(player, channelId))
{
return NULL;
}
if (channelId == CHANNEL_GUILD)
{
ChatChannel* newChannel = new ChatChannel(channelId, player->getGuild()->getName());
m_guildChannels[player->getGuildId()] = newChannel;
return newChannel;
}
else if (channelId == CHANNEL_PARTY)
{
if (!player->getParty())
{
return NULL;
}
PrivateChatChannel* newChannel = new PrivateChatChannel(channelId, "Party");
m_partyChannels[player->getParty()] = newChannel;
return newChannel;
}
else if (channelId == CHANNEL_PRIVATE)
{
// Private chat channel
//only 1 private channel for each player
if (getPrivateChannel(player))
{
return NULL;
}
//find a free private channel slot
uint16_t i = getFreePrivateChannelId();
if (i != 0)
{
PrivateChatChannel* newChannel = new PrivateChatChannel(i, player->getName() + "'s Channel");
if (!newChannel)
{
return NULL;
}
newChannel->setOwner(player->getGUID());
m_privateChannels[i] = newChannel;
return newChannel;
}
}
return NULL;
}
示例3: createChannel
ChatChannel* Chat::createChannel(const Player& player, uint16_t channelId)
{
if (getChannel(player, channelId)) {
return NULL;
}
switch (channelId) {
case CHANNEL_GUILD: {
Guild* guild = player.getGuild();
if (guild) {
ChatChannel* newChannel = new ChatChannel(channelId, guild->getName());
guildChannels[guild->getId()] = newChannel;
return newChannel;
}
break;
}
case CHANNEL_PARTY: {
Party* party = player.getParty();
if (party) {
ChatChannel* newChannel = new ChatChannel(channelId, "Party");
partyChannels[party] = newChannel;
return newChannel;
}
break;
}
case CHANNEL_PRIVATE: {
//only 1 private channel for each premium player
if (!player.isPremium() || getPrivateChannel(player)) {
return NULL;
}
//find a free private channel slot
for (uint16_t i = 100; i < 10000; ++i) {
if (privateChannels.find(i) == privateChannels.end()) {
PrivateChatChannel* newChannel = new PrivateChatChannel(i, player.getName() + "'s Channel");
newChannel->setOwner(player.getGUID());
privateChannels[i] = newChannel;
return newChannel;
}
}
break;
}
default:
break;
}
return NULL;
}
示例4: createChannel
ChatChannel* Chat::createChannel(Player* player, uint16_t channelId)
{
if(getChannel(player, channelId))
return NULL;
if(channelId == 0x00){
ChatChannel *newChannel = new ChatChannel(channelId, player->getGuildName());
if(!newChannel)
return NULL;
m_guildChannels[player->getGuildId()] = newChannel;
return newChannel;
}
else if(channelId == 0xFFFF){
//only 1 private channel for each player
if(getPrivateChannel(player)){
return NULL;
}
//find a free private channel slot
for(uint16_t i = 100; i < 10000; ++i){
if(m_privateChannels.find(i) == m_privateChannels.end()){
PrivateChatChannel* newChannel = new PrivateChatChannel(i, player->getName() + "'s Channel");
if(!newChannel)
return NULL;
newChannel->setOwner(player->getGUID());
m_privateChannels[i] = newChannel;
return newChannel;
}
}
}
return NULL;
}