本文整理汇总了C++中CAr类的典型用法代码示例。如果您正苦于以下问题:C++ CAr类的具体用法?C++ CAr怎么用?C++ CAr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CAr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Serialize
int CRTMessenger::Serialize( CAr & ar )
{
if( ar.IsStoring() )
{
ar << m_dwState;
ar << static_cast<int>( size() );
for( map<u_long, Friend>::iterator i = begin(); i != end(); ++i )
{
ar << i->first;
ar.Write( &i->second, sizeof(Friend) );
}
}
else
{
clear();
ar >> m_dwState;
int nSize;
ar >> nSize;
if( nSize > MAX_FRIEND )
return nSize;
u_long idFriend;
int i; for( i = 0; i < nSize; i++ )
{
ar >> idFriend;
Friend f;
ar.Read( &f, sizeof(Friend) );
SetFriend( idFriend, &f );
}
}
return 0;
}
示例2: OnServersetList
void CDPAccountClient::OnServersetList( CAr & ar, DPID dpid )
{
ar.ReadString( g_dpCertifier.m_szVer );
#ifdef __SECURITY_0628
ar.ReadString( g_dpCertifier.m_szResVer );
#endif // __SECURITY_0628
ar >> g_dpCertifier.m_dwSizeofServerset;
LPSERVER_DESC pServer;
for( DWORD i = 0; i < g_dpCertifier.m_dwSizeofServerset; i++ )
{
pServer = g_dpCertifier.m_aServerset + i;
ar >> pServer->dwParent;
ar >> pServer->dwID;
ar.ReadString( pServer->lpName, 36 );
ar.ReadString( pServer->lpAddr, 16 );
ar >> pServer->b18;
ar >> pServer->lCount;
ar >> pServer->lEnable;
ar >> pServer->lMax;
// if( pServer->dwParent != NULL_ID )
{
u_long uId = pServer->dwParent * 100 + pServer->dwID;
g_dpCertifier.m_2ServersetPtr.insert( map<u_long, LPSERVER_DESC>::value_type( uId, pServer ) );
}
}
}
示例3: MAKELONG
void CGlobalGiftbox::OnQuery( CDPMng<CBuffer>* pdp, CAr & ar, DPID dpid ) // recv & check & save
{
u_long idPlayer;
DWORD dwGiftbox, dwItem, dwObjId;
int nNum, nQueryGiftbox;
ar >> idPlayer >> dwGiftbox >> dwItem >> nNum >> dwObjId >> nQueryGiftbox;
map<DWORD, int>::iterator i = m_map.find( MAKELONG( (WORD)dwGiftbox, (WORD)dwItem ) );
if( i == m_map.end() )
{
Error( "CGlobalGiftbox::OnQuery: key not found, g: %d, i: %d", dwGiftbox, dwItem );
return;
}
BOOL bResult = FALSE;
if( i->second > 0 )
{
i->second--;
bResult = TRUE;
}
CAr arResult;
arResult << PACKETTYPE_QUERYGLOBALGIFTBOX;
arResult << idPlayer << dwGiftbox << dwItem << nNum << dwObjId << nQueryGiftbox << bResult;
int nBufSize;
LPBYTE lpBuf = arResult.GetBuffer( &nBufSize );
pdp->Send( lpBuf, nBufSize, dpid );
Save();
}
示例4: Serialize
void CServerDesc::Serialize( CAr & ar )
{
if( ar.IsStoring() )
{
ar << m_uKey;
ar << (short)m_lspJurisdiction.size();
for( list<CJurisdiction*>::iterator i = m_lspJurisdiction.begin(); i != m_lspJurisdiction.end(); ++i )
{
ar << (*i)->m_dwWorldID;
ar << (*i)->m_rect;
ar << (*i)->m_wLeft;
ar << (*i)->m_wRight;
}
ar.WriteString( m_szAddr );
}
else
{
u_long uKey;
ar >> uKey;
SetKey( uKey );
short nSize;
ar >> nSize;
for( int i =0; i < nSize; i++ )
{
CJurisdiction* pJurisdiction = new CJurisdiction;
ar >> pJurisdiction->m_dwWorldID;
ar >> pJurisdiction->m_rect;
ar >> pJurisdiction->m_wLeft;
ar >> pJurisdiction->m_wRight;
m_lspJurisdiction.push_back( pJurisdiction );
}
ar.ReadString( m_szAddr );
}
}
示例5: OnGameStartReceive
// 과금정보의 ACK
void CDPBilling::OnGameStartReceive( CAr & ar, DPID dpid )
{
char szAccount[MAX_ID_LENGTH];
char szTimeOverDays[13];
long lRemainDays;
long lResult;
ar >> lResult;
ar.Read( szAccount, MAX_ID_LENGTH );
ar >> lRemainDays;
ar.Read( szTimeOverDays, 12 );
szTimeOverDays[12] = '\0';
lResult = ntohl( lResult ); // 호스트 바이 오더로 변환한다.
lRemainDays = ntohl( lRemainDays );
// @flyff.jp가 붙은 유저 문자열에서 @flyff.jp를 제거한다
int i;
for( i=0; i<MAX_ID_LENGTH; ++i )
{
if( szAccount[i] == 0x20 )
break;
}
i -= ENDMARK_LENGTH; // ENDMARK_LENGTH = strlen("@flyff.jp");
szAccount[i] = '\0';
char szBuffer[1024];
sprintf(szBuffer, "recv 0x00010001 - GAME_START_RECEIVE\nstatus:%d user:%s remainday:%d enddate:%s\n",
lResult, szAccount, lRemainDays, szTimeOverDays );
OutputDebugString( szBuffer );
CTime tmOverDays = 0;
if( lResult == SUCCESS )
{
char sYear[3] = { 0, };
char sMonth[3] = { 0, };
char sDay[3] = { 0, };
char sHour[3] = { 0, };
char sMin[3] = { 0, };
strncpy( sYear, szTimeOverDays, 2 );
strncpy( sMonth, szTimeOverDays + 2, 2 );
strncpy( sDay, szTimeOverDays + 4, 2 );
strncpy( sHour, szTimeOverDays + 6, 2 );
strncpy( sMin, szTimeOverDays + 8, 2 );
tmOverDays = CTime( 2000 + atoi( sYear ), atoi( sMonth ), atoi( sDay ), 0, 0, 0 );
}
BILLING_INFO info;
info.szAccount = szAccount;
info.dwKey = 0;
info.lResult = lResult;
info.pTimeOverDays = &tmOverDays; // tmOverDays는 lResult가 SUCCESS인 경우에만 설정되면 된다.
g_AccountMng.SendBillingResult( &info );
}
示例6: Serialize
void CParty::Serialize( CAr & ar )
{
if( ar.IsStoring() )
{
ar << m_uPartyId << m_nKindTroup << m_nSizeofMember;
ar << m_nLevel << m_nExp << m_nPoint;
ar << m_nTroupsShareExp << m_nTroupeShareItem;
ar << m_idDuelParty;
for( int i = 0 ; i < MAX_PARTYMODE ; i++ )
{
ar << m_nModeTime[i];
}
if( m_nKindTroup )
ar.WriteString( m_sParty );
for( i = 0 ; i < m_nSizeofMember ; i++ )
{
ar << m_aMember[i].m_uPlayerId;
#if __VER < 11 // __SYS_PLAYER_DATA
ar << m_aMember[i].m_nLevel;
ar << m_aMember[i].m_nJob;
#endif // __SYS_PLAYER_DATA
ar << m_aMember[i].m_bRemove;
#if __VER < 11 // __SYS_PLAYER_DATA
ar << m_aMember[i].m_nSex;
ar.WriteString( m_aMember[i].m_szName );
#endif // __SYS_PLAYER_DATA
}
}
else
{
ar >> m_uPartyId >> m_nKindTroup >> m_nSizeofMember;
ar >> m_nLevel >> m_nExp >> m_nPoint;
ar >> m_nTroupsShareExp >> m_nTroupeShareItem;
ar >> m_idDuelParty;
for( int i = 0 ; i < MAX_PARTYMODE ; i++ )
{
ar >> m_nModeTime[i];
}
if( m_nKindTroup )
ar.ReadString( m_sParty, 33 );
for( i = 0 ; i < m_nSizeofMember ; i++ )
{
ar >> m_aMember[i].m_uPlayerId;
#if __VER < 11 // __SYS_PLAYER_DATA
ar >> m_aMember[i].m_nLevel;
ar >> m_aMember[i].m_nJob;
#endif // __SYS_PLAYER_DATA
ar >> m_aMember[i].m_bRemove;
#if __VER < 11 // __SYS_PLAYER_DATA
ar >> m_aMember[i].m_nSex;
ar.ReadString( m_aMember[i].m_szName, 20 );
#endif // __SYS_PLAYER_DATA
}
}
}
示例7: Write
void CWantedListSnapshot::Write( CAr& ar )
{
ar << m_lRecvTime;
ar << (int)m_wantedList.size();
WANTED_ENTRY_VECTOR::iterator it;
for( it = m_wantedList.begin(); it != m_wantedList.end(); ++it )
{
ar.WriteString( (*it).szPlayer );
ar << (*it).nGold;
ar << (*it).nEnd;
ar.WriteString( (*it).szMsg );
}
}
示例8: Serialize
void CItemBase::Serialize( CAr & ar ) // 11 // 20
{
if( ar.IsStoring() )
{
ar << m_dwObjId << m_dwItemId;
ar << m_liSerialNumber;
ar.WriteString( m_szItemText );
}
else
{
ar >> m_dwObjId >> m_dwItemId;
ar >> m_liSerialNumber;
ar.ReadString( m_szItemText, 32 );
}
}
示例9: OutputDebugString
// 빌링서버에 connect될 때, 이를 빌링서버에 알린다.
void CDPBilling::SendGSCSStart()
{
OutputDebugString("send 0x00000005 - GSCS_START\n");
char cbServerName[MAX_SERVERNAME];
AppendEndMark( cbServerName, g_szServerName, MAX_SERVERNAME );
CAr ar;
int nBufSize;
ar << htonl( static_cast<DWORD>(GSCS_START_SEND) );
ar.Write( cbServerName, MAX_SERVERNAME );
SEND( ar, this, DPID_SERVERPLAYER );
}
示例10: Serialize
void CCampusMember::Serialize( CAr & ar )
{
if( ar.IsStoring() )
ar << m_idPlayer << m_nMemberLv;
else
ar >> m_idPlayer >> m_nMemberLv;
}
示例11: SerializeLevel
void IBuff::SerializeLevel( CAr & ar )
{
if( ar.IsStoring() )
{
#ifdef __DBSERVER
if( GetType() == BUFF_ITEM2 )
{
time_t t = static_cast<time_t>( GetLevel() ) - time_null();
ar << t;
}
else
{
ar << m_dwLevel;
}
#else // __DBSERVER
ar << m_dwLevel;
#endif // __DBSERVER
}
else
{
#ifdef __DBSERVER
if( GetType() == BUFF_ITEM2 )
{
time_t t;
ar >> t;
SetLevel( time_null() + t );
}
else
{
示例12: Serialize
void CGuildWarMng::Serialize( CAr & ar )
{
if( ar.IsStoring() )
{
ar << m_id;
ar << GetSize();
for( map<u_long, CGuildWar*>::iterator i = m_mapPWar.begin(); i != m_mapPWar.end(); ++i )
( i->second )->Serialize( ar );
}
else
{
#ifdef __CLIENT
Clear();
#endif // __CLIENT
ar >> m_id;
int nSize;
ar >> nSize;
for( int i = 0; i < nSize; i++ )
{
CGuildWar* pWar = new CGuildWar;
pWar->Serialize( ar );
m_mapPWar.insert( map<u_long, CGuildWar*>::value_type( pWar->m_idWar, pWar ) );
}
}
}
示例13: Serialize
void CPocket::Serialize( CAr & ar )
{
CItemContainer<CItemElem>::Serialize( ar );
if( ar.IsStoring() )
{
ar << m_bExpired << m_tExpirationDate;
if( m_tExpirationDate )
{
time_t t = m_tExpirationDate - time_null();
ar << t;
}
}
else
{
ar >> m_bExpired >> m_tExpirationDate;
if( m_tExpirationDate )
{
time_t t;
ar >> t;
#ifdef __CLIENT
m_tExpirationDate = time_null() + t;
#endif // __CLIENT
}
}
}
示例14: OnOverview
void CDPConsole::OnOverview( CAr & ar )
{
CTime tm = CTime::GetCurrentTime();
printf( "\n%s", tm.Format( "%Y/%m/%d %H:%M:%S" ) );
printf( "\n--------------------------------------------------------------------------------" );
*sOverview = '\0';
ar.ReadString( sOverview );
#ifdef __QLORD
HideAddr( sOverview );
#endif // __QLORD
printf( "%s", sOverview );
printf( "--------------------------------------------------------------------------------" );
#ifdef __QLORD
printf( "\nCommand: q>" );
#else // __QLORD
printf( "\nCommand: r, s, q>" );
#endif // __QLORD
if( strstr( sOverview, "x" ) != NULL )
sndPlaySound( "type.wav", SND_ASYNC | SND_LOOP );
else
sndPlaySound( NULL, SND_ASYNC );
SetEvent( hPrompt );
}
示例15: Clear
void CPocketController::Serialize( CAr & ar )
{
if( ar.IsStoring() )
{
for( int i = 0; i < MAX_POCKET; i++ )
{
if( IsAvailable( i, FALSE ) )
{
ar << (BYTE)1;
m_apPocket[i]->Serialize( ar );
}
else
ar << (BYTE)0;
}
}
else
{
Clear();
for( int i = 0; i < MAX_POCKET; i++ )
{
BYTE bExists;
ar >> bExists;
if( !bExists )
continue;
Avail( i );
m_apPocket[i]->Serialize( ar );
}
}
}