本文整理汇总了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;
}
}
// 加入黑名单
示例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 );
}