From 09a33580170076f14b2d46d72ad93d60fe52fc07 Mon Sep 17 00:00:00 2001 From: Stanislav Bas Date: Wed, 8 Jul 2015 00:04:14 +0300 Subject: [PATCH] Add NAME and DELE handling to Global record --- components/esm/loadglob.cpp | 16 ++++++++++++++++ components/esm/loadglob.hpp | 2 ++ 2 files changed, 18 insertions(+) diff --git a/components/esm/loadglob.cpp b/components/esm/loadglob.cpp index a78ed1a1b..6cc37d675 100644 --- a/components/esm/loadglob.cpp +++ b/components/esm/loadglob.cpp @@ -1,6 +1,9 @@ #include "loadglob.hpp" +#include "esmreader.hpp" +#include "esmwriter.hpp" #include "defs.hpp" +#include "util.hpp" namespace ESM { @@ -8,11 +11,24 @@ namespace ESM void Global::load (ESMReader &esm) { + mId = esm.getHNString("NAME"); + if (mIsDeleted = readDeleSubRecord(esm)) + { + return; + } + mValue.read (esm, ESM::Variant::Format_Global); } void Global::save (ESMWriter &esm) const { + esm.writeHNCString("NAME", mId); + if (mIsDeleted) + { + writeDeleSubRecord(esm); + return; + } + mValue.write (esm, ESM::Variant::Format_Global); } diff --git a/components/esm/loadglob.hpp b/components/esm/loadglob.hpp index cc5dbbdcf..45b47a3bc 100644 --- a/components/esm/loadglob.hpp +++ b/components/esm/loadglob.hpp @@ -24,6 +24,8 @@ struct Global std::string mId; Variant mValue; + bool mIsDeleted; + void load(ESMReader &esm); void save(ESMWriter &esm) const;