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


C++ USER::DelRelation方法代码示例

本文整理汇总了C++中USER::DelRelation方法的典型用法代码示例。如果您正苦于以下问题:C++ USER::DelRelation方法的具体用法?C++ USER::DelRelation怎么用?C++ USER::DelRelation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在USER的用法示例。


在下文中一共展示了USER::DelRelation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Execute


//.........这里部分代码省略.........
                pTServerPlayer->SendPacket( &NotifyMsg );
            }
        }
        break;
    case REQ_ADDTOBLACKLIST:
    case REQ_TEMPFRIEND_ADDTO_BLACKLIST:
        { // 检查需要添加的是否在线,并发回详细信息,这里不做合法性判断
            REQUEST_ADD_RELATION& ReqRelation = pRelationPacket->m_AddRelation;

            if ( ReqRelation.GetTargetGUID() != INVALID_ID )
            {
                pTargetUser = g_pOnlineUser->FindUser( ReqRelation.GetTargetGUID() );
            }
            else if ( strlen(ReqRelation.GetTargetName()) > 0 )
            {
                pTargetUser = g_pOnlineUser->FindUser( ReqRelation.GetTargetName() );
            }

            if ( pTargetUser == NULL )
            { //没有发现在“在线用户列表”里对应此名字的用户
                uErr = RET_ERR_TARGETNOTEXIST;

                Log::SaveLog( WORLD_LOGFILE, "GWRelationHandler...User Name=%s not find!",
                    ReqRelation.GetTargetName() );
                Assert( FALSE && "找不到该人" );
                break;
            }

            RELATION_TYPE RelationType = pUser->GetRelationType( pTargetUser->GetGUID() );
            if ( RelationType != RELATION_TYPE_NONE )
            {
                if ( RelationType == RELATION_TYPE_FRIEND )
                {
                    pUser->DelRelation( pTargetUser->GetGUID() );
                }
                else
                {
                    switch( RelationType )
                    {
                    case RELATION_TYPE_BLACKNAME:
                        uErr = RET_ERR_ISBLACKNAME;
                        break;
                    case RELATION_TYPE_MARRY:
                        uErr = RET_ERR_SPOUSETOBLACKLIST;
                        break;
                    case RELATION_TYPE_MASTER:
                        uErr = RET_ERR_MASTERTOBLACKLIST;
                        break;
                    case RELATION_TYPE_PRENTICE:
                        uErr = RET_ERR_PRENTICETOBLACKLIST;
                        break;
                    case RELATION_TYPE_BROTHER:
                        uErr = RET_ERR_BROTHERTOBLACKLIST;
                        break;
                    default:
                        Assert(FALSE);
                        return PACKET_EXE_CONTINUE;
                    }

                    Log::SaveLog( WORLD_LOGFILE, "GWRelationHandler...User Name=%s can't be added4!",
                        ReqRelation.GetTargetName() );
                    break;
                }
            }

            // 加入黑名单
开发者ID:gangzi4494,项目名称:web-pap,代码行数:67,代码来源:GWRelationHandler.cpp

示例2: Execute


//.........这里部分代码省略.........
		//		ReqRelation.GetTargetName() );
	//	}
	//	break;
	case REQ_ADDTOENEMY:
		{ 
			// 检查需要添加的是否在线,并发回详细信息,这里不做合法性判断
			REQUEST_ADD_RELATION& ReqRelation = pRelationPacket->m_AddRelation;


			if ( ReqRelation.GetTargetGUID() != INVALID_ID )
			{
				pTargetUser = g_pOnlineUser->FindUser( ReqRelation.GetTargetGUID() );
			}
			else if ( strlen(ReqRelation.GetTargetName()) > 0 )
			{
				pTargetUser = g_pOnlineUser->FindUser( ReqRelation.GetTargetName() );
			}

			if ( pTargetUser == NULL )
			{ //没有发现在“在线用户列表”里对应此名字的用户
				uErr = RET_ERR_TARGETNOTEXIST;

				Log::SaveLog( WORLD_LOGFILE, "GWRelationHandler...User Name=%s not find!",
					ReqRelation.GetTargetName() );
				Assert( FALSE && "找不到该人" );
				break;
			}

			RELATION_TYPE RelationType = pUser->GetRelationType( pTargetUser->GetGUID() );

			// 如果要添加到仇人列表中的玩家是自己的好友或者黑名单中的人物,则双方先都把对方删除
			if ( RelationType == RELATION_TYPE_FRIEND || RelationType == RELATION_TYPE_BLACKNAME )
			{
				pUser->DelRelation( pTargetUser->GetGUID() );
				pTargetUser->DelRelation( pUser->GetGUID() );

				WGRelation MyDelFriendMsg;
				MyDelFriendMsg.GetRelation()->CleanUp();
				MyDelFriendMsg.GetRelation()->SetPlayerID( pUser->GetPlayerID() );
				MyDelFriendMsg.GetRelation()->m_Type = RET_DELFRIENDFORADDENEMY;
				MyDelFriendMsg.GetRelation()->m_RelationGUID.CleanUp();
				MyDelFriendMsg.GetRelation()->m_RelationGUID.SetTargetGUID( pTargetUser->GetGUID() );
				pServerPlayer->SendPacket( &MyDelFriendMsg );


				WGRelation DelFriendMsg;
				DelFriendMsg.GetRelation()->CleanUp();
				DelFriendMsg.GetRelation()->SetPlayerID( pTargetUser->GetPlayerID() );
				DelFriendMsg.GetRelation()->m_Type = RET_DELFRIENDFORADDENEMY;
				DelFriendMsg.GetRelation()->m_RelationGUID.CleanUp();
				DelFriendMsg.GetRelation()->m_RelationGUID.SetTargetGUID( pUser->GetGUID() );
				ServerPlayer* pTServerPlayer = g_pServerManager->GetServerPlayer( pTargetUser->GetServerID() );
				if( pTServerPlayer==NULL )
				{
					Assert(FALSE);
					break;
				}
				pTServerPlayer->SendPacket( &DelFriendMsg );

				// 将删除的好友加入到好友递减列表
				time_t NowTime = g_pTimeManager->GetANSITime();

				pUser->AddRelationDelPoint( pTargetUser->GetGUID(), NowTime );
				pTargetUser->AddRelationDelPoint( pUser->GetGUID(), NowTime );

			}
开发者ID:,项目名称:,代码行数:67,代码来源:


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