当前位置: 首页>>代码示例>>C++>>正文


C++ PrivateChatChannel::setOwner方法代码示例

本文整理汇总了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;
}
开发者ID:Codex-NG,项目名称:thecrystalserver,代码行数:58,代码来源:chat.cpp

示例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;
}
开发者ID:edubart,项目名称:otserv,代码行数:54,代码来源:chat.cpp

示例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;
}
开发者ID:Alvaritos,项目名称:forgottenserver,代码行数:50,代码来源:chat.cpp

示例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;
}
开发者ID:gianflogao,项目名称:divinity-ots,代码行数:36,代码来源:chat.cpp


注:本文中的PrivateChatChannel::setOwner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。