示例#1
0
void PetExchangeInfo::LoadInfoFromFile(CFileStream &rFileStream)
{
    if (!rFileStream.IsOpen() )
        return;

    unsigned char nAttributeType = 0;
    unsigned char nQualityType = 0;
    unsigned int nItemType = 0;
    unsigned short nItemCount = 0;
    unsigned short nCount = 0;

    rFileStream.ReadUShort(nCount);

    for (unsigned short i = 0; i < nCount; ++i)
    {
        rFileStream.ReadUChar(nAttributeType);
        rFileStream.ReadUChar(nQualityType);
        rFileStream.ReadUInt(nItemType);
        rFileStream.ReadUShort(nItemCount);

        ASSERT(ePetAttributeType_None < nAttributeType && nAttributeType < ePetAttributeType_Max);
        ASSERT(ePetQualityType_None < nQualityType && nQualityType < ePetQualityType_Max);
        ASSERT(nItemType > 0);
        ASSERT(nItemCount > 0);

        CItem item(nItemType, nItemCount, -1, false);

        AddExchangeInfo(nAttributeType, nQualityType, item);
    }
}
示例#2
0
void CMedalCfgMgr::LoadProgressConfigFromFile( CFileStream &rFileStream )
{
    if ( !rFileStream.IsOpen() )
        return;

    m_mapMedalProgressCfg.clear();

    unsigned short nCount = 0;
    rFileStream.ReadUShort( nCount );

    for ( unsigned short i = 0; i < nCount; ++i )
    {
        CMedalProgressCfg processInfo;

        if ( processInfo.LoadInfoFromFile( rFileStream ) )
        {
            m_mapMedalProgressCfg.insert( std::make_pair( processInfo.GetId(), processInfo ) );
        }
    }
}