mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-22 11:09:40 +00:00
Add NAME and DELE handling to Cell record
This commit is contained in:
parent
847614c26f
commit
b667338a8f
2 changed files with 18 additions and 8 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include "esmwriter.hpp"
|
#include "esmwriter.hpp"
|
||||||
#include "defs.hpp"
|
#include "defs.hpp"
|
||||||
#include "cellid.hpp"
|
#include "cellid.hpp"
|
||||||
|
#include "util.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -54,10 +55,17 @@ namespace ESM
|
||||||
|
|
||||||
void Cell::load(ESMReader &esm, bool saveContext)
|
void Cell::load(ESMReader &esm, bool saveContext)
|
||||||
{
|
{
|
||||||
|
loadName(esm);
|
||||||
loadData(esm);
|
loadData(esm);
|
||||||
loadCell(esm, saveContext);
|
loadCell(esm, saveContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Cell::loadName(ESMReader &esm)
|
||||||
|
{
|
||||||
|
mName = esm.getHNString("NAME");
|
||||||
|
mIsDeleted = readDeleSubRecord(esm);
|
||||||
|
}
|
||||||
|
|
||||||
void Cell::loadCell(ESMReader &esm, bool saveContext)
|
void Cell::loadCell(ESMReader &esm, bool saveContext)
|
||||||
{
|
{
|
||||||
mRefNumCounter = 0;
|
mRefNumCounter = 0;
|
||||||
|
@ -105,13 +113,6 @@ void Cell::loadCell(ESMReader &esm, bool saveContext)
|
||||||
|
|
||||||
void Cell::loadData(ESMReader &esm)
|
void Cell::loadData(ESMReader &esm)
|
||||||
{
|
{
|
||||||
// Ignore this for now, it might mean we should delete the entire
|
|
||||||
// cell?
|
|
||||||
// TODO: treat the special case "another plugin moved this ref, but we want to delete it"!
|
|
||||||
if (esm.isNextSub("DELE")) {
|
|
||||||
esm.skipHSub();
|
|
||||||
}
|
|
||||||
|
|
||||||
esm.getHNT(mData, "DATA", 12);
|
esm.getHNT(mData, "DATA", 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,6 +125,12 @@ void Cell::postLoad(ESMReader &esm)
|
||||||
|
|
||||||
void Cell::save(ESMWriter &esm) const
|
void Cell::save(ESMWriter &esm) const
|
||||||
{
|
{
|
||||||
|
esm.writeHNCString("NAME", mName);
|
||||||
|
if (mIsDeleted)
|
||||||
|
{
|
||||||
|
writeDeleSubRecord(esm);
|
||||||
|
}
|
||||||
|
|
||||||
esm.writeHNT("DATA", mData, 12);
|
esm.writeHNT("DATA", mData, 12);
|
||||||
if (mData.mFlags & Interior)
|
if (mData.mFlags & Interior)
|
||||||
{
|
{
|
||||||
|
@ -147,7 +154,7 @@ void Cell::save(ESMWriter &esm) const
|
||||||
esm.writeHNT("NAM5", mMapColor);
|
esm.writeHNT("NAM5", mMapColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mRefNumCounter != 0)
|
if (mRefNumCounter != 0 && !mIsDeleted)
|
||||||
esm.writeHNT("NAM0", mRefNumCounter);
|
esm.writeHNT("NAM0", mRefNumCounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,11 +112,14 @@ struct Cell
|
||||||
CellRefTracker mLeasedRefs;
|
CellRefTracker mLeasedRefs;
|
||||||
MovedCellRefTracker mMovedRefs;
|
MovedCellRefTracker mMovedRefs;
|
||||||
|
|
||||||
|
bool mIsDeleted;
|
||||||
|
|
||||||
void postLoad(ESMReader &esm);
|
void postLoad(ESMReader &esm);
|
||||||
|
|
||||||
// This method is left in for compatibility with esmtool. Parsing moved references currently requires
|
// This method is left in for compatibility with esmtool. Parsing moved references currently requires
|
||||||
// passing ESMStore, bit it does not know about this parameter, so we do it this way.
|
// passing ESMStore, bit it does not know about this parameter, so we do it this way.
|
||||||
void load(ESMReader &esm, bool saveContext = true); // Load everything (except references)
|
void load(ESMReader &esm, bool saveContext = true); // Load everything (except references)
|
||||||
|
void loadName(ESMReader &esm); // Load NAME and checks for DELE
|
||||||
void loadData(ESMReader &esm); // Load DATAstruct only
|
void loadData(ESMReader &esm); // Load DATAstruct only
|
||||||
void loadCell(ESMReader &esm, bool saveContext = true); // Load everything, except DATAstruct and references
|
void loadCell(ESMReader &esm, bool saveContext = true); // Load everything, except DATAstruct and references
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue