forked from teamnwah/openmw-tes3coop
moved code for writing/reading ref nums into RefNum struct
This commit is contained in:
parent
9670e0881d
commit
764c155cec
2 changed files with 23 additions and 8 deletions
|
@ -4,6 +4,23 @@
|
||||||
#include "esmreader.hpp"
|
#include "esmreader.hpp"
|
||||||
#include "esmwriter.hpp"
|
#include "esmwriter.hpp"
|
||||||
|
|
||||||
|
void ESM::RefNum::load (ESMReader& esm, bool wide)
|
||||||
|
{
|
||||||
|
if (wide)
|
||||||
|
esm.getHNT (*this, "FRMR", 8);
|
||||||
|
else
|
||||||
|
esm.getHNT (mIndex, "FRMR");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ESM::RefNum::save (ESMWriter &esm, bool wide) const
|
||||||
|
{
|
||||||
|
if (wide)
|
||||||
|
esm.writeHNT ("FRMR", *this, 8);
|
||||||
|
else
|
||||||
|
esm.writeHNT ("FRMR", mIndex, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ESM::CellRef::load (ESMReader& esm, bool wideRefNum)
|
void ESM::CellRef::load (ESMReader& esm, bool wideRefNum)
|
||||||
{
|
{
|
||||||
// According to Hrnchamd, this does not belong to the actual ref. Instead, it is a marker indicating that
|
// According to Hrnchamd, this does not belong to the actual ref. Instead, it is a marker indicating that
|
||||||
|
@ -13,10 +30,7 @@ void ESM::CellRef::load (ESMReader& esm, bool wideRefNum)
|
||||||
if (esm.isNextSub ("NAM0"))
|
if (esm.isNextSub ("NAM0"))
|
||||||
esm.skipHSub();
|
esm.skipHSub();
|
||||||
|
|
||||||
if (wideRefNum)
|
mRefNum.load (esm, wideRefNum);
|
||||||
esm.getHNT (mRefNum, "FRMR", 8);
|
|
||||||
else
|
|
||||||
esm.getHNT (mRefNum.mIndex, "FRMR");
|
|
||||||
|
|
||||||
mRefID = esm.getHNString ("NAME");
|
mRefID = esm.getHNString ("NAME");
|
||||||
|
|
||||||
|
@ -74,10 +88,7 @@ void ESM::CellRef::load (ESMReader& esm, bool wideRefNum)
|
||||||
|
|
||||||
void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory) const
|
void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory) const
|
||||||
{
|
{
|
||||||
if (wideRefNum)
|
mRefNum.save (esm, wideRefNum);
|
||||||
esm.writeHNT ("FRMR", mRefNum, 8);
|
|
||||||
else
|
|
||||||
esm.writeHNT ("FRMR", mRefNum.mIndex, 4);
|
|
||||||
|
|
||||||
esm.writeHNCString("NAME", mRefID);
|
esm.writeHNCString("NAME", mRefID);
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,10 @@ namespace ESM
|
||||||
{
|
{
|
||||||
int mIndex;
|
int mIndex;
|
||||||
int mContentFile; // -1 no content file
|
int mContentFile; // -1 no content file
|
||||||
|
|
||||||
|
void load (ESMReader& esm, bool wide = false);
|
||||||
|
|
||||||
|
void save (ESMWriter &esm, bool wide = false) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Cell reference. This represents ONE object (of many) inside the
|
/* Cell reference. This represents ONE object (of many) inside the
|
||||||
|
|
Loading…
Reference in a new issue