Example #1
0
    void WeatherState::load(ESMReader& esm)
    {
        mCurrentRegion = esm.getHNString(currentRegionRecord);
        esm.getHNT(mTimePassed, timePassedRecord);
        esm.getHNT(mFastForward, fastForwardRecord);
        esm.getHNT(mWeatherUpdateTime, weatherUpdateTimeRecord);
        esm.getHNT(mTransitionFactor, transitionFactorRecord);
        esm.getHNT(mCurrentWeather, currentWeatherRecord);
        esm.getHNT(mNextWeather, nextWeatherRecord);
        esm.getHNT(mQueuedWeather, queuedWeatherRecord);

        while(esm.peekNextSub(regionNameRecord))
        {
            std::string regionID = esm.getHNString(regionNameRecord);
            RegionWeatherState region;
            esm.getHNT(region.mWeather, regionWeatherRecord);
            while(esm.peekNextSub(regionChanceRecord))
            {
                char chance;
                esm.getHNT(chance, regionChanceRecord);
                region.mChances.push_back(chance);
            }

            mRegions.insert(std::make_pair(regionID, region));
        }
    }
Example #2
0
    bool Cell::getNextRef(ESMReader &esm, CellRef &ref, bool &isDeleted, bool ignoreMoves, MovedCellRef *mref)
    {
        isDeleted = false;

        // TODO: Try and document reference numbering, I don't think this has been done anywhere else.
        if (!esm.hasMoreSubs())
            return false;

        // NOTE: We should not need this check. It is a safety check until we have checked
        // more plugins, and how they treat these moved references.
        if (esm.isNextSub("MVRF"))
        {
            if (ignoreMoves)
            {
                esm.getHT (mref->mRefNum.mIndex);
                esm.getHNOT (mref->mTarget, "CNDT");
                adjustRefNum (mref->mRefNum, esm);
            }
            else
            {
                // skip rest of cell record (moved references), they are handled elsewhere
                esm.skipRecord(); // skip MVRF, CNDT
                return false;
            }
        }

        if (esm.peekNextSub("FRMR"))
        {
            ref.load (esm, isDeleted);

            // Identify references belonging to a parent file and adapt the ID accordingly.
            adjustRefNum (ref.mRefNum, esm);
            return true;
        }
        return false;
    }