コード例 #1
0
void CDPCoreClient::OnQueryRemovePlayer( CAr & ar )
{
	char lpszAccount[MAX_ACCOUNT] = { 0, };
	ar.ReadString( lpszAccount, MAX_ACCOUNT );

	CMclAutoLock	Lock( g_UserMng.m_AddRemoveLock );
	CUser* pUser	= g_UserMng.GetUser( lpszAccount );
	if( pUser )
	{
		pUser->m_idPlayer	= 0;
		g_dpLoginSrvr.DestroyPlayer( pUser->m_dpid );
	}
	else
	{
		WriteLog( "OnQueryRemovePlayer(): lpszAccount not found, %s", lpszAccount );
	}
}
コード例 #2
0
void CDPCoreClient::OnPreJoin( CAr & ar )
{
	CHAR lpszAccount[MAX_ACCOUNT], lpszPlayer[MAX_PLAYER];
	DWORD dwAuthKey;
	u_long idPlayer;
	BYTE f;
	ar >> dwAuthKey;
	ar.ReadString( lpszAccount, MAX_ACCOUNT );
	ar >> idPlayer;
	ar.ReadString( lpszPlayer, MAX_PLAYER );
	ar >> f;

	CMclAutoLock	Lock( g_UserMng.m_AddRemoveLock );

	CUser* pUser	= g_UserMng.GetUser( lpszAccount );
	if( pUser )
	{
		if( pUser->m_dwAuthKey == dwAuthKey )
		{
			if( f )	// o
				g_dpLoginSrvr.SendHdr( PACKETTYPE_PRE_JOIN, pUser->m_dpid );
			else
			{
				WriteLog( "OnPreJoin(): recv 0 from CORE, %s", lpszAccount );
				pUser->m_idPlayer	= 0;
				g_dpLoginSrvr.DestroyPlayer( pUser->m_dpid );
			}
		}
		else
		{
			WriteLog( "OnPreJoin(): Different dwAuthKey" );
			g_dpLoginSrvr.DestroyPlayer( pUser->m_dpid );
		}
	}
	else
	{
		WriteLog( "OnPreJoin(): Account not found, %s", lpszAccount );
		//
	}
}