示例#1
0
void CDPClient::UserMessageHandler( LPDPMSG_GENERIC lpMsg, DWORD dwMsgSize, DPID idFrom )
{
	static size_t	nSize	= sizeof(DPID);

#ifdef __CRASH_0404
	CCrashStatus::GetInstance()->SetLastPacket( this, 0xEEEEEEEE );
#endif	// __CRASH_0404

	LPBYTE lpBuf	= (LPBYTE)lpMsg + nSize;
	ULONG	uBufSize	= dwMsgSize - nSize;
	DPID dpidUser	= *(UNALIGNED LPDPID)lpMsg;

	CAr ar( lpBuf, uBufSize );
	GETTYPE( ar );

	void ( theClass::*pfn )( theParameters )	=	GetHandler( dw );
	
#ifdef __CRASH_0404
	CCrashStatus::GetInstance()->SetLastPacket( this, dw );
#endif	// __CRASH_0404

	if( pfn )
		( this->*( pfn ) )( ar, dpidUser, lpMsg, dwMsgSize );
	else
		g_DPCacheSrvr.Send( lpBuf, uBufSize, dpidUser );

#ifdef __CRASH_0404
	CCrashStatus::GetInstance()->SetLastPacket( this, 0xFFFFFFFF );
#endif	// __CRASH_0404
}
void CDPCoreClient::UserMessageHandler( LPDPMSG_GENERIC lpMsg, DWORD dwMsgSize, DPID idFrom )
{
	static size_t	nSize	= sizeof(DPID);

#ifdef __CRASH_0404
	CCrashStatus::GetInstance()->SetLastPacket( this, 0xEEEEEEEE );
#endif	// __CRASH_0404

	LPBYTE lpBuf	= (LPBYTE)lpMsg + nSize;
	ULONG	uBufSize	= dwMsgSize - nSize;
	DPID dpidUser	= *(UNALIGNED LPDPID)lpMsg;

	CAr ar( lpBuf, uBufSize );
	GETTYPE( ar );

#ifdef __CRASH_0404
	CCrashStatus::GetInstance()->SetLastPacket( this, dw );
#endif	// __CRASH_0404

	void ( theClass::*pfn )( theParameters )	=	GetHandler( dw );
	
	if( pfn )
		( this->*( pfn ) )( ar, dpidUser );
	else
	{
		switch( dw )
		{
			case PACKETTYPE_SUMMONPLAYER:
			case PACKETTYPE_TELEPORTPLAYER:
			case PACKETTYPE_MODIFYMODE:
			case PACKETTYPE_BUYING_INFO:
				{
					CMclAutoLock	Lock( CPlayerMng::Instance()->m_AddRemoveLock );
					g_DPClientArray.SendToServer( dpidUser, lpMsg, dwMsgSize );
					break;
				}
			default:
				g_DPCacheSrvr.Send( lpBuf, uBufSize, dpidUser );
				break;
		}
	}
#ifdef __CRASH_0404
	CCrashStatus::GetInstance()->SetLastPacket( this, 0xFFFFFFFF );
#endif	// __CRASH_0404
}