示例#1
0
    void Skill::load(ESMReader &esm)
    {
        bool hasIndex = false;
        bool hasData = false;
        while (esm.hasMoreSubs())
        {
            esm.getSubName();
            uint32_t name = esm.retSubName().val;
            switch (name)
            {
                case ESM::FourCC<'I','N','D','X'>::value:
                    esm.getHT(mIndex);
                    hasIndex = true;
                    break;
                case ESM::FourCC<'S','K','D','T'>::value:
                    esm.getHT(mData, 24);
                    hasData = true;
                    break;
                case ESM::FourCC<'D','E','S','C'>::value:
                    mDescription = esm.getHString();
                    break;
                default:
                    esm.fail("Unknown subrecord");
            }
        }
        if (!hasIndex)
            esm.fail("Missing INDX");
        if (!hasData)
            esm.fail("Missing SKDT");

        // create an ID from the index and the name (only used in the editor and likely to change in the
        // future)
        mId = indexToId (mIndex);
    }
示例#2
0
void GameSetting::load(ESMReader &esm)
{
    assert(mId != "");

    // We are apparently allowed to be empty
    if (!esm.hasMoreSubs())
    {
        mType = VT_None;
        return;
    }

    // Load some data
    esm.getSubName();
    NAME n = esm.retSubName();
    if (n == "STRV")
    {
        mStr = esm.getHString();
        mType = VT_String;
    }
    else if (n == "INTV")
    {
        esm.getHT(mI);
        mType = VT_Int;
    }
    else if (n == "FLTV")
    {
        esm.getHT(mF);
        mType = VT_Float;
    }
    else
        esm.fail("Unwanted subrecord type");
}
示例#3
0
void ESM::VariantIntegerData::read (ESMReader& esm, Variant::Format format, VarType type)
{
    if (type!=VT_Short && type!=VT_Long && type!=VT_Int)
        throw std::logic_error ("not an integer type");

    if (format==Variant::Format_Global)
    {
        float value;
        esm.getHNT (value, "FLTV");

        if (type==VT_Short)
        {
            if (value!=value)
                mValue = 0; // nan
            else
                mValue = static_cast<short> (value);
        }
        else if (type==VT_Long)
            mValue = static_cast<int> (value);
        else
            esm.fail ("unsupported global variable integer type");
    }
    else if (format==Variant::Format_Gmst || format==Variant::Format_Info)
    {
        if (type!=VT_Int)
        {
            std::ostringstream stream;
            stream
                << "unsupported " <<(format==Variant::Format_Gmst ? "gmst" : "info")
                << " variable integer type";
            esm.fail (stream.str());
        }

        esm.getHT (mValue);
    }
    else if (format==Variant::Format_Local)
    {
        if (type==VT_Short)
        {
            short value;
            esm.getHT(value);
            mValue = value;
        }
        else if (type==VT_Int)
        {
            esm.getHT(mValue);
        }
        else
            esm.fail("unsupported local variable integer type");
    }
}
示例#4
0
void ESM::Header::load (ESMReader &esm)
{
    if (esm.isNextSub ("FORM"))
    {
        esm.getHT (mFormat);
        if (mFormat<0)
            esm.fail ("invalid format code");
    }
    else
        mFormat = 0;

    if (esm.isNextSub("HEDR"))
    {
      esm.getSubHeader();
      esm.getT(mData.version);
      esm.getT(mData.type);
      mData.author.assign(esm.getString(sizeof(mData.author.name)));
      mData.desc.assign(esm.getString(sizeof(mData.desc.name)));
      esm.getT(mData.records);
    }

    while (esm.isNextSub ("MAST"))
    {
        MasterData m;
        m.name = esm.getHString();
        m.size = esm.getHNLong ("DATA");
        mMaster.push_back (m);
    }

    if (esm.isNextSub("GMDT"))
    {
        esm.getHT(mGameData);
    }
    if (esm.isNextSub("SCRD"))
    {
        esm.getSubHeader();
        mSCRD.resize(esm.getSubSize());
        if (mSCRD.size())
            esm.getExact(&mSCRD[0], mSCRD.size());
    }
    if (esm.isNextSub("SCRS"))
    {
        esm.getSubHeader();
        mSCRS.resize(esm.getSubSize());
        if (mSCRS.size())
            esm.getExact(&mSCRS[0], mSCRS.size());
    }
}
示例#5
0
 void Weapon::load(ESMReader &esm)
 {
     bool hasData = false;
     while (esm.hasMoreSubs())
     {
         esm.getSubName();
         uint32_t name = esm.retSubName().val;
         switch (name)
         {
             case ESM::FourCC<'M','O','D','L'>::value:
                 mModel = esm.getHString();
                 break;
             case ESM::FourCC<'F','N','A','M'>::value:
                 mName = esm.getHString();
                 break;
             case ESM::FourCC<'W','P','D','T'>::value:
                 esm.getHT(mData, 32);
                 hasData = true;
                 break;
             case ESM::FourCC<'S','C','R','I'>::value:
                 mScript = esm.getHString();
                 break;
             case ESM::FourCC<'I','T','E','X'>::value:
                 mIcon = esm.getHString();
                 break;
             case ESM::FourCC<'E','N','A','M'>::value:
                 mEnchant = esm.getHString();
                 break;
             default:
                 esm.fail("Unknown subrecord");
         }
     }
     if (!hasData)
         esm.fail("Missing WPDT subrecord");
 }
示例#6
0
    void SpellState::load(ESMReader &esm)
    {
        while (esm.isNextSub("SPEL"))
        {
            std::string id = esm.getHString();

            std::map<const int, float> random;
            while (esm.isNextSub("INDX"))
            {
                int index;
                esm.getHT(index);

                float magnitude;
                esm.getHNT(magnitude, "RAND");

                random[index] = magnitude;
            }

            mSpells[id] = random;
        }

        while (esm.isNextSub("USED"))
        {
            std::string id = esm.getHString();
            TimeStamp time;
            esm.getHNT(time, "TIME");

            mUsedPowers[id] = time;
        }

        mSelectedSpell = esm.getHNOString("SLCT");
    }
示例#7
0
void BodyPart::load(ESMReader &esm)
{
    bool hasData = false;
    while (esm.hasMoreSubs())
    {
        esm.getSubName();
        uint32_t name = esm.retSubName().val;
        switch (name)
        {
            case ESM::FourCC<'M','O','D','L'>::value:
                mModel = esm.getHString();
                break;
            case ESM::FourCC<'F','N','A','M'>::value:
                mRace = esm.getHString();
                break;
            case ESM::FourCC<'B','Y','D','T'>::value:
                esm.getHT(mData, 4);
                hasData = true;
                break;
            default:
                esm.fail("Unknown subrecord");
        }
    }

    if (!hasData)
        esm.fail("Missing BYDT subrecord");
}
示例#8
0
void LeveledListBase::load(ESMReader &esm)
{
    esm.getHNT(mFlags, "DATA");
    esm.getHNT(mChanceNone, "NNAM");

    if (esm.isNextSub("INDX"))
    {
        int len;
        esm.getHT(len);
        mList.resize(len);
    }
    else
        return;

    // TODO: Merge with an existing lists here. This can be done
    // simply by adding the lists together, making sure that they are
    // sorted by level. A better way might be to exclude repeated
    // items. Also, some times we don't want to merge lists, just
    // overwrite. Figure out a way to give the user this option.

    for (size_t i = 0; i < mList.size(); i++)
    {
        LevelItem &li = mList[i];
        li.mId = esm.getHNString(mRecName);
        esm.getHNT(li.mLevel, "INTV");
    }
}
示例#9
0
void ESM::Player::load (ESMReader &esm)
{
    mObject.load (esm);

    mCellId.load (esm);

    esm.getHNT (mLastKnownExteriorPosition, "LKEP", 12);

    if (esm.isNextSub ("MARK"))
    {
        mHasMark = true;
        esm.getHT (mMarkedPosition, 24);
        mMarkedCell.load (esm);
    }
    else
        mHasMark = false;

    mAutoMove = 0;
    esm.getHNOT (mAutoMove, "AMOV");

    mBirthsign = esm.getHNString ("SIGN");

    mCurrentCrimeId = -1;
    esm.getHNOT (mCurrentCrimeId, "CURD");
    mPayedCrimeId = -1;
    esm.getHNOT (mPayedCrimeId, "PAYD");
}
示例#10
0
void ESM::DebugProfile::load (ESMReader& esm, bool &isDeleted)
{
    isDeleted = false;

    while (esm.hasMoreSubs())
    {
        esm.getSubName();
        switch (esm.retSubName().intval)
        {
            case ESM::SREC_NAME:
                mId = esm.getHString();
                break;
            case ESM::FourCC<'D','E','S','C'>::value:
                mDescription = esm.getHString();
                break;
            case ESM::FourCC<'S','C','R','P'>::value:
                mScriptText = esm.getHString();
                break;
            case ESM::FourCC<'F','L','A','G'>::value:
                esm.getHT(mFlags);
                break;
            case ESM::SREC_DELE:
                esm.skipHSub();
                isDeleted = true;
                break;
            default:
                esm.fail("Unknown subrecord");
                break;
        }
    }
}
示例#11
0
void EffectList::load(ESMReader &esm)
{
    ENAMstruct s;
    while (esm.isNextSub("ENAM")) {
        esm.getHT(s, 24);
        mList.push_back(s);
    }
}
示例#12
0
void InventoryList::load(ESMReader &esm)
{
    ContItem ci;
    while (esm.isNextSub("NPCO"))
    {
        esm.getHT(ci, 36);
        mList.push_back(ci);
    }
}
示例#13
0
    bool Cell::getNextMVRF(ESMReader &esm, MovedCellRef &mref)
    {
        esm.getHT(mref.mRefNum.mIndex);
        esm.getHNOT(mref.mTarget, "CNDT");

        adjustRefNum (mref.mRefNum, esm);

        return true;
    }
示例#14
0
    void Faction::load(ESMReader &esm, bool &isDeleted)
    {
        isDeleted = false;

        mReactions.clear();
        for (int i=0;i<10;++i)
            mRanks[i].clear();

        int rankCounter = 0;
        bool hasName = false;
        bool hasData = false;
        while (esm.hasMoreSubs())
        {
            esm.getSubName();
            switch (esm.retSubName().val)
            {
                case ESM::SREC_NAME:
                    mId = esm.getHString();
                    hasName = true;
                    break;
                case ESM::FourCC<'F','N','A','M'>::value:
                    mName = esm.getHString();
                    break;
                case ESM::FourCC<'R','N','A','M'>::value:
                    if (rankCounter >= 10)
                        esm.fail("Rank out of range");
                    mRanks[rankCounter++] = esm.getHString();
                    break;
                case ESM::FourCC<'F','A','D','T'>::value:
                    esm.getHT(mData, 240);
                    if (mData.mIsHidden > 1)
                        esm.fail("Unknown flag!");
                    hasData = true;
                    break;
                case ESM::FourCC<'A','N','A','M'>::value:
                {
                    std::string faction = esm.getHString();
                    int reaction;
                    esm.getHNT(reaction, "INTV");
                    mReactions[faction] = reaction;
                    break;
                }
                case ESM::SREC_DELE:
                    esm.skipHSub();
                    isDeleted = true;
                    break;
                default:
                    esm.fail("Unknown subrecord");
                    break;
            }
        }

        if (!hasName)
            esm.fail("Missing NAME subrecord");
        if (!hasData && !isDeleted)
            esm.fail("Missing FADT subrecord");
    }
示例#15
0
 void Container::load(ESMReader &esm)
 {
     mInventory.mList.clear();
     bool hasWeight = false;
     bool hasFlags = false;
     while (esm.hasMoreSubs())
     {
         esm.getSubName();
         uint32_t name = esm.retSubName().val;
         switch (name)
         {
             case ESM::FourCC<'M','O','D','L'>::value:
                 mModel = esm.getHString();
                 break;
             case ESM::FourCC<'F','N','A','M'>::value:
                 mName = esm.getHString();
                 break;
             case ESM::FourCC<'C','N','D','T'>::value:
                 esm.getHT(mWeight, 4);
                 hasWeight = true;
                 break;
             case ESM::FourCC<'F','L','A','G'>::value:
                 esm.getHT(mFlags, 4);
                 if (mFlags & 0xf4)
                     esm.fail("Unknown flags");
                 if (!(mFlags & 0x8))
                     esm.fail("Flag 8 not set");
                 hasFlags = true;
                 break;
             case ESM::FourCC<'S','C','R','I'>::value:
                 mScript = esm.getHString();
                 break;
             case ESM::FourCC<'N','P','C','O'>::value:
                 mInventory.add(esm);
                 break;
             default:
                 esm.fail("Unknown subrecord");
         }
     }
     if (!hasWeight)
         esm.fail("Missing CNDT subrecord");
     if (!hasFlags)
         esm.fail("Missing FLAG subrecord");
 }
示例#16
0
void Cell::loadCell(ESMReader &esm, bool saveContext)
{
    mRefNumCounter = 0;

    if (mData.mFlags & Interior)
    {
        // Interior cells
        if (esm.isNextSub("INTV"))
        {
            int waterl;
            esm.getHT(waterl);
            mWater = (float) waterl;
            mWaterInt = true;
        }
        else if (esm.isNextSub("WHGT"))
        {
            esm.getHT(mWater);
        }

        // Quasi-exterior cells have a region (which determines the
        // weather), pure interior cells have ambient lighting
        // instead.
        if (mData.mFlags & QuasiEx)
            mRegion = esm.getHNOString("RGNN");
        else if (esm.isNextSub("AMBI"))
            esm.getHT(mAmbi);
    }
    else
    {
        // Exterior cells
        mRegion = esm.getHNOString("RGNN");

        mMapColor = 0;
        esm.getHNOT(mMapColor, "NAM5");
    }
    if (esm.isNextSub("NAM0")) {
        esm.getHT(mRefNumCounter);
    }

    if (saveContext) {
        mContextList.push_back(esm.getContext());
        esm.skipRecord();
    }
}
示例#17
0
    void Spell::load(ESMReader &esm, bool &isDeleted)
    {
        isDeleted = false;

        mEffects.mList.clear();

        bool hasName = false;
        bool hasData = false;
        while (esm.hasMoreSubs())
        {
            esm.getSubName();
            switch (esm.retSubName().val)
            {
                case ESM::SREC_NAME:
                    mId = esm.getHString();
                    hasName = true;
                    break;
                case ESM::FourCC<'F','N','A','M'>::value:
                    mName = esm.getHString();
                    break;
                case ESM::FourCC<'S','P','D','T'>::value:
                    esm.getHT(mData, 12);
                    hasData = true;
                    break;
                case ESM::FourCC<'E','N','A','M'>::value:
                    ENAMstruct s;
                    esm.getHT(s, 24);
                    mEffects.mList.push_back(s);
                    break;
                case ESM::SREC_DELE:
                    esm.skipHSub();
                    isDeleted = true;
                    break;
                default:
                    esm.fail("Unknown subrecord");
                    break;
            }
        }

        if (!hasName)
            esm.fail("Missing NAME subrecord");
        if (!hasData && !isDeleted)
            esm.fail("Missing SPDT subrecord");
    }
示例#18
0
    void Cell::loadCell(ESMReader &esm, bool saveContext)
    {
        bool isLoaded = false;
        while (!isLoaded && esm.hasMoreSubs())
        {
            esm.getSubName();
            switch (esm.retSubName().intval)
            {
                case ESM::FourCC<'I','N','T','V'>::value:
                    int waterl;
                    esm.getHT(waterl);
                    mWater = static_cast<float>(waterl);
                    mWaterInt = true;
                    break;
                case ESM::FourCC<'W','H','G','T'>::value:
                    esm.getHT(mWater);
                    mWaterInt = false;
                    break;
                case ESM::FourCC<'A','M','B','I'>::value:
                    esm.getHT(mAmbi);
                    break;
                case ESM::FourCC<'R','G','N','N'>::value:
                    mRegion = esm.getHString();
                    break;
                case ESM::FourCC<'N','A','M','5'>::value:
                    esm.getHT(mMapColor);
                    break;
                case ESM::FourCC<'N','A','M','0'>::value:
                    esm.getHT(mRefNumCounter);
                    break;
                default:
                    esm.cacheSubName();
                    isLoaded = true;
                    break;
            }
        }

        if (saveContext) 
        {
            mContextList.push_back(esm.getContext());
            esm.skipRecord();
        }
    }
示例#19
0
 void load(ESMReader &esm)
 {
   while(esm.isNextSub("INDX"))
     {
       PartReference pr;
       esm.getHT(pr.part); // The INDX byte
       pr.male = esm.getHNOString("BNAM");
       pr.female = esm.getHNOString("CNAM");
     }
 }
示例#20
0
 void AiWander::load(ESMReader &esm)
 {
     esm.getHNT (mData, "DATA");
     esm.getHNT(mDurationData, "STAR"); // was mStartTime
     mStoredInitialActorPosition = false;
     if (esm.isNextSub("POS_"))
     {
         mStoredInitialActorPosition = true;
         esm.getHT(mInitialActorPosition);
     }
 }
示例#21
0
void ESM::CellRef::loadData(ESMReader &esm)
{
    // Again, UNAM sometimes appears after NAME and sometimes later.
    // Or perhaps this UNAM means something different?
    mReferenceBlocked = -1;
    esm.getHNOT (mReferenceBlocked, "UNAM");

    mScale = 1.0;
    esm.getHNOT (mScale, "XSCL");

    mOwner = esm.getHNOString ("ANAM");
    mGlobalVariable = esm.getHNOString ("BNAM");
    mSoul = esm.getHNOString ("XSOL");

    mFaction = esm.getHNOString ("CNAM");
    mFactionRank = -2;
    esm.getHNOT (mFactionRank, "INDX");

    mGoldValue = 1;
    mChargeInt = -1;
    mEnchantmentCharge = -1;

    esm.getHNOT (mEnchantmentCharge, "XCHG");

    esm.getHNOT (mChargeInt, "INTV");

    esm.getHNOT (mGoldValue, "NAM9");

    // Present for doors that teleport you to another cell.
    if (esm.isNextSub ("DODT"))
    {
        mTeleport = true;
        esm.getHT (mDoorDest);
        mDestCell = esm.getHNOString ("DNAM");
    }
    else
        mTeleport = false;

    mLockLevel = 0; //Set to 0 to indicate no lock
    esm.getHNOT (mLockLevel, "FLTV");

    mKey = esm.getHNOString ("KNAM");
    mTrap = esm.getHNOString ("TNAM");

    esm.getHNOT (mReferenceBlocked, "UNAM");
    if (esm.isNextSub("FLTV")) // no longer used
        esm.skipHSub();

    esm.getHNOT(mPos, "DATA", 24);

    if (esm.isNextSub("NAM0"))
        esm.skipHSub();
}
示例#22
0
void ESM::CellId::load (ESMReader &esm)
{
    mWorldspace = esm.getHNString ("SPAC");

    if (esm.isNextSub ("CIDX"))
    {
        esm.getHT (mIndex, 8);
        mPaged = true;
    }
    else
        mPaged = false;
}
示例#23
0
    void Book::load(ESMReader &esm, bool &isDeleted)
    {
        isDeleted = false;

        bool hasName = false;
        bool hasData = false;
        while (esm.hasMoreSubs())
        {
            esm.getSubName();
            switch (esm.retSubName().intval)
            {
                case ESM::SREC_NAME:
                    mId = esm.getHString();
                    hasName = true;
                    break;
                case ESM::FourCC<'M','O','D','L'>::value:
                    mModel = esm.getHString();
                    break;
                case ESM::FourCC<'F','N','A','M'>::value:
                    mName = esm.getHString();
                    break;
                case ESM::FourCC<'B','K','D','T'>::value:
                    esm.getHT(mData, 20);
                    hasData = true;
                    break;
                case ESM::FourCC<'S','C','R','I'>::value:
                    mScript = esm.getHString();
                    break;
                case ESM::FourCC<'I','T','E','X'>::value:
                    mIcon = esm.getHString();
                    break;
                case ESM::FourCC<'E','N','A','M'>::value:
                    mEnchant = esm.getHString();
                    break;
                case ESM::FourCC<'T','E','X','T'>::value:
                    mText = esm.getHString();
                    break;
                case ESM::SREC_DELE:
                    esm.skipHSub();
                    isDeleted = true;
                    break;
                default:
                    esm.fail("Unknown subrecord");
                    break;
            }
        }

        if (!hasName)
            esm.fail("Missing NAME subrecord");
        if (!hasData && !isDeleted)
            esm.fail("Missing BKDT subrecord");
    }
示例#24
0
void ESM::VariantFloatData::read (ESMReader& esm, Variant::Format format, VarType type)
{
    if (type!=VT_Float)
        throw std::logic_error ("not a float type");

    if (format==Variant::Format_Global)
    {
        esm.getHNT (mValue, "FLTV");
    }
    else if (format==Variant::Format_Gmst || format==Variant::Format_Info)
    {
        esm.getHT (mValue);
    }
}
示例#25
0
    void Cell::loadNameAndData(ESMReader &esm, bool &isDeleted)
    {
        isDeleted = false;

        blank();

        bool hasData = false;
        bool isLoaded = false;
        while (!isLoaded && esm.hasMoreSubs())
        {
            esm.getSubName();
            switch (esm.retSubName().intval)
            {
                case ESM::SREC_NAME:
                    mName = esm.getHString();
                    break;
                case ESM::FourCC<'D','A','T','A'>::value:
                    esm.getHT(mData, 12);
                    hasData = true;
                    break;
                case ESM::SREC_DELE:
                    esm.skipHSub();
                    isDeleted = true;
                    break;
                default:
                    esm.cacheSubName();
                    isLoaded = true;
                    break;
            }
        }

        if (!hasData)
            esm.fail("Missing DATA subrecord");

        mCellId.mPaged = !(mData.mFlags & Interior);

        if (mCellId.mPaged)
        {
            mCellId.mWorldspace = ESM::CellId::sDefaultWorldspace;
            mCellId.mIndex.mX = mData.mX;
            mCellId.mIndex.mY = mData.mY;
        }
        else
        {
            mCellId.mWorldspace = Misc::StringUtils::lowerCase (mName);
            mCellId.mIndex.mX = 0;
            mCellId.mIndex.mY = 0;
        }
    }
示例#26
0
文件: loadcell.cpp 项目: Aozi/openmw
bool Cell::getNextMVRF(ESMReader &esm, MovedCellRef &mref)
{
    esm.getHT(mref.mRefnum);
    esm.getHNOT(mref.mTarget, "CNDT");

    // Identify references belonging to a parent file and adapt the ID accordingly.
    int local = (mref.mRefnum & 0xff000000) >> 24;
    size_t global = esm.getIndex() + 1;
    mref.mRefnum &= 0x00ffffff; // delete old plugin ID
    const std::vector<Header::MasterData> &masters = esm.getGameFiles();
    global = masters[local-1].index + 1;
    mref.mRefnum |= global << 24; // insert global plugin ID

    return true;
}
示例#27
0
    void Race::load(ESMReader &esm, bool &isDeleted)
    {
        isDeleted = false;

        mPowers.mList.clear();

        bool hasName = false;
        bool hasData = false;
        while (esm.hasMoreSubs())
        {
            esm.getSubName();
            switch (esm.retSubName().val)
            {
                case ESM::SREC_NAME:
                    mId = esm.getHString();
                    hasName = true;
                    break;
                case ESM::FourCC<'F','N','A','M'>::value:
                    mName = esm.getHString();
                    break;
                case ESM::FourCC<'R','A','D','T'>::value:
                    esm.getHT(mData, 140);
                    hasData = true;
                    break;
                case ESM::FourCC<'D','E','S','C'>::value:
                    mDescription = esm.getHString();
                    break;
                case ESM::FourCC<'N','P','C','S'>::value:
                    mPowers.add(esm);
                    break;
                case ESM::SREC_DELE:
                    esm.skipHSub();
                    isDeleted = true;
                    break;
                default:
                    esm.fail("Unknown subrecord");
            }
        }

        if (!hasName)
            esm.fail("Missing NAME subrecord");
        if (!hasData && !isDeleted)
            esm.fail("Missing RADT subrecord");
    }
示例#28
0
void Faction::load(ESMReader &esm)
{
    mReactions.clear();
    for (int i=0;i<10;++i)
        mRanks[i].clear();

    int rankCounter=0;
    bool hasData = false;
    while (esm.hasMoreSubs())
    {
        esm.getSubName();
        uint32_t name = esm.retSubName().val;
        switch (name)
        {
            case ESM::FourCC<'F','N','A','M'>::value:
                mName = esm.getHString();
                break;
            case ESM::FourCC<'R','N','A','M'>::value:
                if (rankCounter >= 10)
                    esm.fail("Rank out of range");
                mRanks[rankCounter++] = esm.getHString();
                break;
            case ESM::FourCC<'F','A','D','T'>::value:
                esm.getHT(mData, 240);
                if (mData.mIsHidden > 1)
                    esm.fail("Unknown flag!");
                hasData = true;
                break;
            case ESM::FourCC<'A','N','A','M'>::value:
            {
                std::string faction = esm.getHString();
                int reaction;
                esm.getHNT(reaction, "INTV");
                mReactions[faction] = reaction;
                break;
            }
            default:
                esm.fail("Unknown subrecord");
        }
    }
    if (!hasData)
        esm.fail("Missing FADT subrecord");
}
示例#29
0
    void Class::load(ESMReader &esm, bool &isDeleted)
    {
        isDeleted = false;

        bool hasName = false;
        bool hasData = false;
        while (esm.hasMoreSubs())
        {
            esm.getSubName();
            switch (esm.retSubName().intval)
            {
                case ESM::SREC_NAME:
                    mId = esm.getHString();
                    hasName = true;
                    break;
                case ESM::FourCC<'F','N','A','M'>::value:
                    mName = esm.getHString();
                    break;
                case ESM::FourCC<'C','L','D','T'>::value:
                    esm.getHT(mData, 60);
                    if (mData.mIsPlayable > 1)
                        esm.fail("Unknown bool value");
                    hasData = true;
                    break;
                case ESM::FourCC<'D','E','S','C'>::value:
                    mDescription = esm.getHString();
                    break;
                case ESM::SREC_DELE:
                    esm.skipHSub();
                    isDeleted = true;
                    break;
                default:
                    esm.fail("Unknown subrecord");
                    break;
            }
        }

        if (!hasName)
            esm.fail("Missing NAME subrecord");
        if (!hasData && !isDeleted)
            esm.fail("Missing CLDT subrecord");
    }
示例#30
0
void ESM::Header::load (ESMReader &esm)
{
    esm.getHNT (mData, "HEDR", 300);

    if (esm.isNextSub ("FORM"))
    {
        esm.getHT (mFormat);
        if (mFormat<0)
            esm.fail ("invalid format code");
    }
    else
        mFormat = 0;

    while (esm.isNextSub ("MAST"))
    {
        MasterData m;
        m.name = esm.getHString();
        m.size = esm.getHNLong ("DATA");
        mMaster.push_back (m);
    }
}