示例#1
0
void CDPMonitor::OnAddConnection( CAr & ar, DPID dpid )
{
	DWORD dwId;
	BOOL fsndPing;

	ar >> dwId >> fsndPing;

	HTREEITEM hItem
							= m_pMonitorDlg->m_tree.FindItem( m_pMonitorDlg->m_tree.GetRootItem(), dwId, true );
	if( hItem != NULL ) {
		PSrvrData pData	= (PSrvrData)m_pMonitorDlg->m_tree.GetItemData( hItem );
		pData->dpid		= dpid;
		pData->dwPing	= timeGetTime();
		pData->fsndPing		= fsndPing;
		pData->tm	= CTime::GetCurrentTime();
		m_pMonitorDlg->m_tree.SetCheck( hItem, FALSE );

		sndPlaySound( NULL, SND_ASYNC );

		CString sItem	= m_pMonitorDlg->m_tree.GetItemText( hItem );
		if( sItem.Find( ".", 0 ) == -1 )
		{	
			char lpAddr[16]	= { 0, };
			GetPlayerAddr( dpid, lpAddr );
			sItem	+= "        ";
			sItem	+= lpAddr;
			m_pMonitorDlg->m_tree.SetItemText( hItem, (LPCSTR)sItem );
		}

		m_pMonitorDlg->m_pDPConsoleSrvr->SendOverview( DPID_ALLPLAYERS );
	}
}
示例#2
0
文件: host.cpp 项目: iceberry/flyffsf
void CHost::OnAddConnection( CAr & ar, DPID dpid )
{
    DWORD dwId;
    ar >> dwId;

    HTREEITEM hItem
        = m_pMonitorDlg->m_tree.FindItem( m_pMonitorDlg->m_tree.GetRootItem(), dwId, true );
    if( hItem != NULL ) {
        PSrvrData pData	= (PSrvrData)m_pMonitorDlg->m_tree.GetItemData( hItem );
        pData->dpid		= dpid;

        CString sItem	= m_pMonitorDlg->m_tree.GetItemText( hItem );
        if( sItem.Find( ".", 0 ) == -1 )
        {
            char lpAddr[16]	= { 0, };
            GetPlayerAddr( dpid, lpAddr );
            sItem	+= "        ";
            sItem	+= lpAddr;
            m_pMonitorDlg->m_tree.SetItemText( hItem, (LPCSTR)sItem );
        }
    }
}