本文整理汇总了C++中GroupPtr::RemovePlayer方法的典型用法代码示例。如果您正苦于以下问题:C++ GroupPtr::RemovePlayer方法的具体用法?C++ GroupPtr::RemovePlayer怎么用?C++ GroupPtr::RemovePlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupPtr
的用法示例。
在下文中一共展示了GroupPtr::RemovePlayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReqSubServerLogin
/**
@brief ReqSubServerLogin
*/
bool CFarmServer::ReqSubServerLogin(farm::ReqSubServerLogin_Packet &packet)
{
GroupPtr pFromGroup = GetServer()->GetRootGroup().GetChildFromPlayer( packet.senderId );
if (!pFromGroup)
{// Error!!
clog::Error( log::ERROR_PROBLEM, "ReqSubServerLogin Error!!, not exist group user id = %d\n\n", packet.senderId );
m_Protocol.AckSubServerLogin( packet.senderId, SEND_T, error::ERR_NOT_FOUND_GROUP);
return false;
}
SubServerGroupPtr pSvrGroup = FindGroup(packet.svrType);
if (!pSvrGroup)
{
//SubServerGroupPtr pNewGroup = dynamic_cast<CSubServerGroup*>(
// GetServer()->GetRootGroup().AddChild( GetServer()->GetGroupFactory()) );
//if (!pNewGroup)
{// Error!!
clog::Error( log::ERROR_PROBLEM, "ReqSubServerLogin Error!!, not exist group %s \n\n", packet.svrType.c_str() );
m_Protocol.AckSubServerLogin( packet.senderId, SEND_T, error::ERR_NO_CREATE_GROUP);
return false;
}
//pSvrGroup = pNewGroup;
}
// Waiting Group -> New Group
pFromGroup->RemovePlayer( pFromGroup->GetNetId(), packet.senderId );
if (!pSvrGroup->AddPlayer(pSvrGroup->GetNetId(), packet.senderId))
{ // Error!!
pFromGroup->AddPlayer(pFromGroup->GetNetId(), packet.senderId); // 복구
clog::Error( log::ERROR_PROBLEM, "ReqSubServerLogin Error!!, not join group\n" );
m_Protocol.AckSubServerLogin( packet.senderId, SEND_T, error::ERR_NOT_JOIN_GROUP);
return false;
}
pSvrGroup->AddViewer( GetServer()->GetRootGroup().GetNetId() );
m_Protocol.AckSubServerLogin( packet.senderId, SEND_T, error::ERR_SUCCESS);
return true;
}