本文整理汇总了C++中CDPCacheSrvr类的典型用法代码示例。如果您正苦于以下问题:C++ CDPCacheSrvr类的具体用法?C++ CDPCacheSrvr怎么用?C++ CDPCacheSrvr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDPCacheSrvr类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitInstance
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
hMainWnd = hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
return FALSE;
SetTimer( hMainWnd, 3, SEC( 60 ), NULL ); // 10(s)
int x = 480, y = 606;
SetWindowPos( hWnd, NULL, x, y, 400, 416, SWP_SHOWWINDOW );
g_MyTrace.Initialize( hWnd, "SquireD", RGB( 0x00, 0x00, 0x00 ), RGB( 0xff, 0xff, 0xff ) );
CTime time = CTime::GetCurrentTime();
g_MyTrace.Add( 0, FALSE, "%s", time.Format( "%Y/%m/%d %H:%M:%S" ) );
g_MyTrace.AddLine( '\0' );
#ifndef _DEBUG
// InitEH();
#endif // _DEBUG
if( !Script( "CacheServer.ini" ) )
return FALSE;
if( InitializeNetLib() == FALSE )
return FALSE;
if( !g_DPCoreClient.ConnectToServer( g_szCoreAddr, PN_CORESRVR + 1 ) )
return FALSE;
#ifdef __CRC
if( !g_DPCacheSrvr.StartServer( g_uPort, FALSE, CSock::crcRead ) )
#else // __CRC
if( !g_DPCacheSrvr.StartServer( g_uPort ) )
#endif // __CRC
return FALSE;
g_MyTrace.AddLine( '-' );
char lpszIpAddr[16];
g_DPCoreClient.GetPlayerAddr( DPID_SERVERPLAYER, lpszIpAddr );
g_MyTrace.Add( CMyTrace::Key( "main" ), FALSE, "%s", lpszIpAddr );
g_MyTrace.AddLine( '-' );
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
示例2: OnQueryDestroyPlayer
void CDPClient::OnQueryDestroyPlayer( CAr & ar, DPID dpid, LPVOID lpBuffer, u_long uBufSize )
{
DWORD dwSerial;
ar >> dwSerial;
u_long idPlayer;
ar >> idPlayer;
CMclAutoLock Lock( CPlayerMng::Instance()->m_AddRemoveLock );
CPlayer* pPlayer = CPlayerMng::Instance()->GetPlayerBySerial( dwSerial );
if( pPlayer )
{
// 성공적으로 찾았으니까 접속을 끊는다.
g_DPCacheSrvr.DestroyPlayer( pPlayer->GetNetworkId() ); // 소켓연결이 끊기고, PACKETTYPE_LEAVE가 월드서버로 간다.
#ifdef __MA_VER11_07 // cache 서버에서 loginserver로 유저접속끊낌을 알려주는 부분
g_DPCoreClient.SendDestroyPlayer( pPlayer );// coresvr를 통해 loginsvr 에도 끊낌을 알려준다
#endif // __MA_VER11_07 // cache 서버에서 loginserver로 유저접속끊낌을 알려주는 부분
return;
}
WriteError( "OnQueryDestroyPlayer - idPlayer:%d GetPlayer return NULL.", idPlayer );
// 찾지 못해도, 끊었다고 알려준다.
BEFORESENDSOLE( out, PACKETTYPE_LEAVE, DPID_UNKNOWN );
out << idPlayer;
LPBYTE lpBuf = out.GetBuffer( &nBufSize );
g_DPClientArray.SendToServer( dpid, lpBuf, nBufSize );
}
示例3: UserMessageHandler
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
}
示例4: OnJoin
void CDPCoreClient::OnJoin( CAr & ar, DPID dpid )
{
CMclAutoLock Lock( CPlayerMng::Instance()->m_AddRemoveLock );
DWORD dwSerial;
BYTE byData;
ar >> dwSerial;
ar >> byData; // 사용하지 않는다.
CPlayer* pPlayer = CPlayerMng::Instance()->GetPlayerBySerial( dwSerial );
if( pPlayer == NULL )
{
WriteLog( "CDPCoreClient::OnJoin - player not found" );
return;
}
CDPClient* pClient = g_DPClientArray.GetClient( pPlayer->GetChannel(), pPlayer->GetWorld(), D3DXVECTOR3(0.0f, 0.0f, 0.0f) );
if( pClient )
{
pPlayer->SetClient( pClient );
pClient->SendJoin( pPlayer );
}
else
{
WriteLog( "CDPCoreClient.OnJoin: server not found id: %d account: %s player: %s world: %d",
pPlayer->GetPlayerId(), pPlayer->GetAccount(), pPlayer->GetPlayer(), pPlayer->GetWorld() );
g_DPCacheSrvr.DestroyPlayer( dpid );
}
}
示例5: ExitInstance
void ExitInstance( void )
{
g_DPCoreClient.DeleteDPObject();
g_DPClientArray.Free();
g_DPCacheSrvr.DeleteDPObject();
UninitializeNetLib();
}
示例6: OnRemoveConnection
void CDPLoginSrvr::OnRemoveConnection( DPID dpid )
{
if( s_dpid == dpid )
{
g_DPCacheSrvr.SendHdr( PACKETTYPE_DESTROY_ALLPLAYERS, DPID_ALLPLAYERS, DPID_ALLPLAYERS );
s_dpid = 0xFFFFFFFF;
g_PlayerMng.Free();
}
}
示例7: OnLeave
void CDPCoreClient::OnLeave( CAr & ar, DPID dpid )
{
CMclAutoLock Lock( CPlayerMng::Instance()->m_AddRemoveLock );
DWORD dwSerial;
ar >> dwSerial;
CPlayer* pPlayer = CPlayerMng::Instance()->GetPlayerBySerial( dwSerial ); // dpid가 serial번호이다.
if( pPlayer )
g_DPCacheSrvr.DestroyPlayer( dpid );
}
示例8: UserMessageHandler
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
}
示例9: ExitInstance
void ExitInstance( void )
{
g_dpCoreSrvr.DeleteDPObject();
g_DPCacheSrvr.DeleteDPObject();
g_dpLoginSrvr.DeleteDPObject();
g_dpDatabaseClient.DeleteDPObject();
g_PartyMng.Clear();
g_PlayerMng.Free();
SAFE_DELETE( CParty::m_pPool );
SAFE_DELETE( CPlayer::m_pPool );
g_GuildMng.m_AddRemoveLock.Enter( theLineFile );
g_GuildWarMng.Clear();
g_GuildMng.m_AddRemoveLock.Leave( theLineFile );
g_GuildMng.Clear();
SAFE_DELETE( CGuildMember::sm_pPool );
SAFE_DELETE( CGuild::sm_pPool );
UninitializeNetLib();
}
示例10: OnKillPlayer
void CDPCoreClient::OnKillPlayer( CAr & ar, DPID dpid )
{
g_DPCacheSrvr.DestroyPlayer( dpid );
}
示例11: Result
void CGuildWarMng::Result( CGuildWar* pWar, CGuild* pDecl, CGuild* pAcpt, int nType, int nWptDecl, int nWptAcpt )
{
CGuild* pWin, *pLose;
switch( nType )
{
case WR_DECL_GN:
case WR_DECL_SR:
case WR_DECL_AB:
case WR_DECL_DD:
case WR_TRUCE:
case WR_DRAW:
{
pWin = pDecl;
pLose = pAcpt;
break;
}
case WR_ACPT_GN:
case WR_ACPT_SR:
case WR_ACPT_AB:
case WR_ACPT_DD:
{
pWin = pAcpt;
pLose = pDecl;
break;
}
}
int nWinPointDecl = 0;
int nWinPoint = 0;
if( nType < WR_TRUCE )
{
#ifdef __CORESERVER
// nWinPoint
nWinPoint = (int)( pWin->m_nWinPoint + ( (float)( 10 + pWin->m_nWinPoint ) / (float)( ( (float)( pWin->m_nWinPoint + 4 ) / (float)( pLose->m_nWinPoint + 1 ) ) * 0.05 ) ) + 1 );
int nMaxWinPoint = (int)( ( 10 + pWin->m_nWinPoint * 0.05 ) * 5 );
if( nWinPoint > nMaxWinPoint )
{
pWin->m_nWinPoint += nMaxWinPoint;
nWinPointDecl = nMaxWinPoint;
}
else
{
pWin->m_nWinPoint += nWinPoint;
nWinPointDecl = nWinPoint;
}
pWin->m_nWin++;
nWinPoint = (int)( ( 10 + pLose->m_nWinPoint * 0.02 ) );
pLose->m_nWinPoint -= nWinPoint;
if( pLose->m_nWinPoint < 0 )
pLose->m_nWinPoint = 0;
pLose->m_nLose++;
#else // __CORESERVER
pDecl->m_nWinPoint = nWptDecl;
pAcpt->m_nWinPoint = nWptAcpt;
pWin->m_nWin++;
pLose->m_nLose++;
#endif // __CORESERVER
}
// Clean up
pWin->m_idWar = 0;
pWin->m_idEnemyGuild = 0;
pLose->m_idWar = 0;
pLose->m_idEnemyGuild = 0;
for( map<u_long, CGuildMember*>::iterator i = pWin->m_mapPMember.begin();
i != pWin->m_mapPMember.end(); ++i )
{
#ifdef __CORESERVER
CPlayer* pPlayer = g_PlayerMng.GetPlayer( i->second->m_idPlayer );
if( pPlayer ) pPlayer->m_idWar = 0;
#endif // __CORESERVER
#ifdef __WORLDSERVER
CUser* pUser = g_UserMng.GetUserByPlayerID( i->second->m_idPlayer );
if( IsValidObj( pUser ) )
{
pUser->m_idWar = 0;
g_UserMng.AddSetWar( pUser, 0 );
pUser->SetPKTargetLimit( 10 );
}
#endif // __WORLDSERVER
}
for( i = pLose->m_mapPMember.begin(); i != pLose->m_mapPMember.end(); ++i )
{
#ifdef __CORESERVER
CPlayer* pPlayer = g_PlayerMng.GetPlayer( i->second->m_idPlayer );
if( pPlayer ) pPlayer->m_idWar = 0;
#endif // __CORESERVER
#ifdef __WORLDSERVER
CUser* pUser = g_UserMng.GetUserByPlayerID( i->second->m_idPlayer );
if( IsValidObj( pUser ) )
{
pUser->m_idWar = 0;
g_UserMng.AddSetWar( pUser, 0 );
pUser->SetPKTargetLimit( 10 );
}
#endif // __WORLDSERVER
}
#ifdef __CORESERVER
//.........这里部分代码省略.........
示例12: OnTimer
void OnTimer( WORD wTimerID )
{
if( wTimerID == TIMER_ID_DEFAULT )
{
g_GameTimer.Compute();
#ifdef __EVE_NEWYEAR
static BOOL s_bCountdown = FALSE;
CTime tmCur = CTime::GetCurrentTime();
if( ::GetLanguage() == LANG_GER || ::GetLanguage() == LANG_FRE )
{
if( !s_bCountdown && tmCur > CTime( 2009, 12, 31, 22, 58, 59 ) && tmCur < CTime( 2009, 12, 31, 23, 0, 0 ) )
{
s_bCountdown = TRUE;
g_DPCacheSrvr.SendHdr( PACKETTYPE_NEWYEAR, DPID_ALLPLAYERS, DPID_ALLPLAYERS );
}
if( tmCur > CTime( 2009, 12, 31, 23, 0, 0 ) )
s_bCountdown = FALSE;
}
else
{
if( !s_bCountdown && tmCur > CTime( 2009, 12, 31, 23, 58, 59 ) && tmCur < CTime( 2010, 1, 1, 0, 0, 0 ) )
{
s_bCountdown = TRUE;
g_DPCacheSrvr.SendHdr( PACKETTYPE_NEWYEAR, DPID_ALLPLAYERS, DPID_ALLPLAYERS );
}
if( tmCur > CTime( 2010, 1, 1, 0, 0, 0 ) )
s_bCountdown = FALSE;
}
#endif // __EVE_NEWYEAR
return;
}
#if !defined(__INTERNALSERVER)
if( wTimerID == TIMER_ID_WANTED ) // 현상금 처리
{
g_dpCoreSrvr.SendCWWantedList(); // 현상금 리스트를 보낸다.
return;
}
#endif // __INTERNALSERVER
#ifdef __EVENT0913
if( wTimerID == TIMER_ID_EVENT0913 )
{
CTime tmCurr = CTime::GetCurrentTime();
BOOL bEventTime = ( tmCurr.GetHour() >= 17 && tmCurr.GetHour() < 18 ) || ( tmCurr.GetHour() >= 22 && tmCurr.GetHour() < 23 );
if( bEventTime && !s_bEvent0913 ) // 이벤트 시간 - 이벤트 설정되어 있지 않으면,
{
g_dpCoreSrvr.SendEvent0913( s_bEvent0913 = TRUE );
}
else if( !bEventTime && s_bEvent0913 ) // 이벤트 시간이 아닌데 이벤트 설정되어 있으면,
{
g_dpCoreSrvr.SendEvent0913( s_bEvent0913 = FALSE );
}
}
#endif // __EVENT0913
#ifdef __EVENT1206
if( wTimerID == TIMER_ID_EVENT1206 )
{
CTime tmCurr = CTime::GetCurrentTime();
BOOL bEventTime;
if( s_bTest )
{
bEventTime = ( tmCurr.GetHour() % 2 == 0 ); // even
}
else
{
bEventTime = ( tmCurr >= CTime( 2005, 12, 10, 19, 0, 0 ) && tmCurr < CTime( 2005, 12, 10, 22, 0, 0 ) )
|| ( tmCurr >= CTime( 2005, 12, 11, 19, 0, 0 ) && tmCurr < CTime( 2005, 12, 11, 22, 0, 0 ) );
}
if( bEventTime && !s_bEvent1206 ) // 이벤트 시간 - 이벤트 설정되어 있지 않으면,
{
g_dpCoreSrvr.SendEvent1206( s_bEvent1206 = TRUE );
}
else if( !bEventTime && s_bEvent1206 ) // 이벤트 시간이 아닌데 이벤트 설정되어 있으면,
{
g_dpCoreSrvr.SendEvent1206( s_bEvent1206 = FALSE );
}
}
#endif // __EVENT1206
if( wTimerID == TIMER_ID_EVENT )
{
BOOL f = FALSE;
CTime tmCurr = CTime::GetCurrentTime();
BOOL bXmas;
if( s_bTest )
{
bXmas = tmCurr < CTime( 2005, 12, 26, 10, 0, 0 );
}
else
{
bXmas = ( tmCurr >= CTime( 2005, 12, 23, 0, 0, 0 ) && tmCurr < CTime( 2005, 12, 27, 9, 0, 0 ) );
}
BOOL bNewYear;
if( s_bTest )
{
//.........这里部分代码省略.........
示例13: InitInstance
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
hMainWnd = hWnd =
CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
int x = 0, y = 416;
SetWindowPos( hWnd, NULL, x, y, 400, 416, SWP_SHOWWINDOW );
g_GameTimer.Compute();
SetTimer( hWnd, TIMER_ID_DEFAULT, 1000, NULL );
#if !defined(__INTERNALSERVER)
SetTimer( hWnd, TIMER_ID_WANTED, g_uWantedElapse, NULL );
#endif
#ifdef __EVENT0913
SetTimer( hWnd, TIMER_ID_EVENT0913, 1000, NULL );
#endif // __EVENT0913
#ifdef __EVENT1206
SetTimer( hWnd, TIMER_ID_EVENT1206, 1000 * 60, NULL );
#endif // __EVENT1206
SetTimer( hWnd, TIMER_ID_EVENT, 1000 * 60, NULL );
g_MyTrace.Initialize( hWnd, "SquireD", RGB( 0xff, 0xff, 0xff ), RGB( 0x00, 0x00, 0x00 ) );
CTime time = CTime::GetCurrentTime();
g_MyTrace.Add( 0, FALSE, "%s", time.Format( "%Y/%m/%d %H:%M:%S" ) );
g_MyTrace.AddLine( '\0' );
#ifndef _DEBUG
// InitEH();
#endif // _DEBUG
g_TickCount.Start();
if( !Script( "CoreServer.ini" ) )
{
return FALSE;
}
if( InitializeNetLib() == FALSE )
return FALSE;
if( !g_dpCoreSrvr.StartServer( PN_CORESRVR + 0 ) )
return FALSE;
if( !g_DPCacheSrvr.StartServer( PN_CORESRVR + 1 ) )
return FALSE;
if( !g_dpLoginSrvr.StartServer( PN_CORESRVR + 2 ) )
return FALSE;
if( !g_dpDatabaseClient.ConnectToServer( szDataBaseAddr, PN_DBSRVR_2, FALSE ) )
{
Error( "Not TransServer Connect" );
return FALSE;
}
if( !g_PartyMng.CreateWorkers() )
{
assert( 0 );
}
#ifdef __ENVIRONMENT_EFFECT
if( CEnvironment::GetInstance()->CreateWorkers() == FALSE )
{
assert( 0 );
}
#else // __ENVIRONMENT_EFFECT
if( !g_Environment.CreateWorkers() )
{
assert( 0 );
}
#endif // __ENVIRONMENT_EFFECT
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}