Beispiel #1
0
int XWorld::Serialize( XArchive& ar )
{
    int size = ar.size();
    //
    int ver = VER_WORLD_SERIALIZE;
    ar << (BYTE)ver;
//	XBREAK( m_listSpots.size() == 0 );
    XBREAK( m_listSpots.size() > 255 );
    ar << (BYTE)m_listSpots.size();	// 최초 생성계정이면 스팟이 없을수도 있음.
    ar << (WORD)0;
    int idx = 0;
    for( XSpot *pSpot : m_listSpots ) {
        XBREAK( pSpot == nullptr );
        int size2 = ar.size();
        XSpot::sSerialize( ar, pSpot );
        int sizeSpot = ar.size() - size2;
        int sizeWorld = ar.size() - size;
#ifdef _GAME_SERVER
        XTRACE( "%s: %s bytes", pSpot->GetpBaseProp()->strIdentifier.c_str(), XE::NtS( sizeSpot ) );
#endif // _GAME_SERVER
        ++idx;
    }
    ar << m_secLastCalc;
    ar << m_listOpendArea;
    // 월드 아카이브의 크기를 리턴한다.
    return ar.size() - size;
}
Beispiel #2
0
int XCampObjHero3::Serialize( XArchive& ar )
{
	XLOCK_OBJ;
	XCampObjBase::Serialize( ar );
	int sizeOld = ar.size();
	XBREAK( m_aryStages[0].size() > 0x7f );
	XBREAK( m_idxLastUnlock > 0x7f );
	//XBREAK( m_idxLastPlay > 0x7f );
	const int numFloor = m_aryStages.size();
	ar << (char)m_aryStages[0].size();		// 모든층은 스테이지 수가 똑같다고 가정.
	ar << (char)m_idxLastUnlock;
	ar << (char)numFloor; //m_idxLastPlay;
	ar << (char)m_cntTry;
	ar << m_timerOpen;
	for( auto& aryStages : m_aryStages ) {
		for( auto& spStageObj : aryStages ) {
			int size2 = ar.size();
			XArchive arStage;
			arStage.SetbForDB( ar.IsForDB() );
			spStageObj->Serialize( arStage );
			ar << arStage;			// 만약 스테이지가 사라지거나 해서 통째로 건너뛰려고 이렇게 함.
			int size22 = ar.size() - size2;
			//		TRACE("%d", size22 );
		}
	}
	int size = ar.size() - sizeOld;
	XBREAK( ar.IsForDB() && size >= 8000 );	
	ar << (short)m_idxFloorByOpen;
	ar << (short)0;
	return 1;
}
Beispiel #3
0
void XSpot::Serialize( XArchive& ar ) 
{
	ar << (BYTE)m_typeSpot;
	XBREAK( m_Level > 255 );
	ar << (BYTE)m_Level;
	XBREAK( m_Score > 0xffff );
	ar << (WORD)m_Score;
	ar << m_snSpot;
	m_timerSpawn.Serialize( ar );
	ar << (BYTE)xboolToByte(m_bDestroy);
	ar << (BYTE)(*((BYTE*)(&m_bitFlag)));
	XBREAK( GetpBaseProp()->idSpot > 0xffff );
	ar << (WORD)GetpBaseProp()->idSpot;
	XBREAK( m_aryDropItems.size() > 10 );
	ar << m_aryDropItems;
	ar << m_Power;
	int num = 0;
	for( auto loot : m_aryLoots )
		if( loot != 0 )
			++num;
	XBREAK( m_numLose > 0xff );
	XBREAK( m_Difficult <= -128 || m_Difficult >= 128 );
	ar << (BYTE)m_numLose;
	ar << (char)m_Difficult;
	ar << (BYTE)0;
	ar << (BYTE)num;
	XBREAK( m_aryLoots.size() > XGAME::xRES_MAX );
	int idx = 0;
	for( auto loot : m_aryLoots ) {
		if( loot != 0 ) {
			ar << idx;
			ar << loot;
		}
		++idx;
	}
	int size = 0;
	// 패킷 최적화 대상. 군단정보는 꼭 필요할때만 보내도록 최적화 해야함.
	if( m_spLegion != nullptr && ar.IsForDB() == false ) {
		int sizeOld = ar.size();
		m_spLegion->SerializeFull( ar );
		size = ar.size() - sizeOld;
		XTRACE("size legion=%d", size );
	} else
		ar << 0;
}
Beispiel #4
0
int XCampObjCommon::Serialize( XArchive& ar )
{
	XLOCK_OBJ;
	XCampObjBase::Serialize( ar );
	int sizeOld = ar.size();
	// strIdentifier는 용량때문에 생략하고 idProp으로 대체
// 	ar << VER_CAMP_SERIALIZE;
// 	if( XBREAK( m_pProp == nullptr ) )
// 		return 0;
// 	ar << m_pProp->idProp;
// 	ar << m_snCampaign;
	XBREAK( m_aryStages[0].size() > 0x7f );
	XBREAK( m_idxLastUnlock > 0x7f );
	//XBREAK( m_idxLastPlay > 0x7f );
	ar << (char)m_aryStages[0].size();		// 모든층은 스테이지 수가 똑같다고 가정.
	ar << (char)m_idxLastUnlock;
	ar << (char)0; //m_idxLastPlay;
	ar << (char)m_cntTry;
	ar << m_idAccTrying;
	ar << m_strTryer;
	ar << m_timerEnter;
	ar << m_timerOpen;
	XBREAK( m_Grade > 0x7f );
	ar << (char)m_Grade;
	ar << (char)0;
	ar << (char)0;
	const int numFloor = m_aryStages.size();
	ar << (char)numFloor;
	for( auto& aryStages : m_aryStages ) {
		for( auto& spStageObj : aryStages ) {
			int size2 = ar.size();
			XArchive arStage;
			arStage.SetbForDB( ar.IsForDB() );
			spStageObj->Serialize( arStage );
			ar << arStage;			// 만약 스테이지가 사라지거나 해서 통째로 건너뛰려고 이렇게 함.
			int size22 = ar.size() - size2;
	//		TRACE("%d", size22 );
		}
	}
	int size = ar.size() - sizeOld;
	XBREAK( ar.IsForDB() && size >= 8000 );
	return 1;
}