mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 21:15:33 +00:00
Write moved references to the save game file (not resolved on loading yet)
This commit is contained in:
parent
2219231230
commit
671561ea37
5 changed files with 27 additions and 6 deletions
|
@ -119,7 +119,6 @@ MWWorld::CellStore *MWWorld::Cells::getExterior (int x, int y)
|
||||||
|
|
||||||
if (result->second.getState()!=CellStore::State_Loaded)
|
if (result->second.getState()!=CellStore::State_Loaded)
|
||||||
{
|
{
|
||||||
// Multiple plugin support for landscape data is much easier than for references. The last plugin wins.
|
|
||||||
result->second.load ();
|
result->second.load ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -636,7 +636,15 @@ namespace MWWorld
|
||||||
writeReferenceCollection<ESM::ObjectState> (writer, mStatics);
|
writeReferenceCollection<ESM::ObjectState> (writer, mStatics);
|
||||||
writeReferenceCollection<ESM::ObjectState> (writer, mWeapons);
|
writeReferenceCollection<ESM::ObjectState> (writer, mWeapons);
|
||||||
|
|
||||||
// TODO: write moved references
|
for (MovedRefTracker::const_iterator it = mMovedToAnotherCell.begin(); it != mMovedToAnotherCell.end(); ++it)
|
||||||
|
{
|
||||||
|
LiveCellRefBase* base = it->first;
|
||||||
|
ESM::RefNum refNum = base->mRef.getRefNum();
|
||||||
|
ESM::CellId movedTo = it->second->getCell()->getCellId();
|
||||||
|
|
||||||
|
refNum.save(writer, true, "MVRF");
|
||||||
|
movedTo.save(writer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellStore::readReferences (ESM::ESMReader& reader,
|
void CellStore::readReferences (ESM::ESMReader& reader,
|
||||||
|
@ -770,6 +778,18 @@ namespace MWWorld
|
||||||
throw std::runtime_error ("unknown type in cell reference section");
|
throw std::runtime_error ("unknown type in cell reference section");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (reader.isNextSub("MVRF"))
|
||||||
|
{
|
||||||
|
reader.cacheSubName();
|
||||||
|
ESM::RefNum refnum;
|
||||||
|
ESM::CellId movedTo;
|
||||||
|
refnum.load(reader, true, "MVRF");
|
||||||
|
movedTo.load(reader);
|
||||||
|
|
||||||
|
std::cout << "moved to " << movedTo.mWorldspace << " " << movedTo.mIndex.mX << " " << movedTo.mIndex.mY << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
updateMergedRefs();
|
updateMergedRefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include "livecellref.hpp"
|
#include "livecellref.hpp"
|
||||||
#include "cellreflist.hpp"
|
#include "cellreflist.hpp"
|
||||||
|
|
||||||
|
#include <components/esm/cellid.hpp>
|
||||||
|
|
||||||
#include <components/esm/loadacti.hpp>
|
#include <components/esm/loadacti.hpp>
|
||||||
#include <components/esm/loadalch.hpp>
|
#include <components/esm/loadalch.hpp>
|
||||||
#include <components/esm/loadappa.hpp>
|
#include <components/esm/loadappa.hpp>
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
#include "esmreader.hpp"
|
#include "esmreader.hpp"
|
||||||
#include "esmwriter.hpp"
|
#include "esmwriter.hpp"
|
||||||
|
|
||||||
void ESM::RefNum::load (ESMReader& esm, bool wide)
|
void ESM::RefNum::load (ESMReader& esm, bool wide, const std::string& tag)
|
||||||
{
|
{
|
||||||
if (wide)
|
if (wide)
|
||||||
esm.getHNT (*this, "FRMR", 8);
|
esm.getHNT (*this, tag.c_str(), 8);
|
||||||
else
|
else
|
||||||
esm.getHNT (mIndex, "FRMR");
|
esm.getHNT (mIndex, tag.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESM::RefNum::save (ESMWriter &esm, bool wide, const std::string& tag) const
|
void ESM::RefNum::save (ESMWriter &esm, bool wide, const std::string& tag) const
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace ESM
|
||||||
unsigned int mIndex;
|
unsigned int mIndex;
|
||||||
int mContentFile;
|
int mContentFile;
|
||||||
|
|
||||||
void load (ESMReader& esm, bool wide = false);
|
void load (ESMReader& esm, bool wide = false, const std::string& tag = "FRMR");
|
||||||
|
|
||||||
void save (ESMWriter &esm, bool wide = false, const std::string& tag = "FRMR") const;
|
void save (ESMWriter &esm, bool wide = false, const std::string& tag = "FRMR") const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue