bool Cell::getNextRef(ESMReader &esm, CellRef &ref, bool& deleted) { // 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")) { esm.skipRecord(); // skip MVRF esm.skipRecord(); // skip CNDT // That should be it, I haven't seen any other fields yet. } ref.load (esm); // Identify references belonging to a parent file and adapt the ID accordingly. adjustRefNum (ref.mRefNum, esm); if (esm.isNextSub("DELE")) { esm.skipHSub(); deleted = true; } else deleted = false; return true; }
void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool base) { Record<Cell> cell = mCells.getRecord (cellIndex); Cell& cell2 = base ? cell.mBase : cell.mModified; cell2.restore (reader, 0); /// \todo fix the index CellRef ref; while (cell2.getNextRef (reader, ref)) { /// \todo handle deleted and moved references std::ostringstream stream; stream << "ref#" << mNextId++; ref.load (reader, cell2, stream.str()); Record<CellRef> record2; record2.mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly; (base ? record2.mBase : record2.mModified) = ref; appendRecord (record2); } mCells.setRecord (cellIndex, cell); }
void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool base) { Record<Cell> cell = mCells.getRecord (cellIndex); Cell& cell2 = base ? cell.mBase : cell.mModified; CellRef ref; while (cell2.getNextRef (reader, ref)) { /// \todo handle deleted and moved references ref.load (reader, cell2, getNewId()); Record<CellRef> record2; record2.mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly; (base ? record2.mBase : record2.mModified) = ref; appendRecord (record2); } mCells.setRecord (cellIndex, cell); }
bool Cell::getNextRef(ESMReader &esm, CellRef &ref, bool& deleted, bool ignoreMoves, MovedCellRef *mref) { // 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; } } ref.load (esm); // Identify references belonging to a parent file and adapt the ID accordingly. adjustRefNum (ref.mRefNum, esm); if (esm.isNextSub("DELE")) { esm.skipHSub(); deleted = true; } else deleted = false; return true; }