From 5cd2fe00ab41eaef4618e017061fd86630987338 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 3 Dec 2012 22:16:02 +0100 Subject: [PATCH] initialise blank global records --- apps/opencs/model/world/idcollection.hpp | 1 + components/esm/loadglob.cpp | 6 ++++++ components/esm/loadglob.hpp | 3 +++ 3 files changed, 10 insertions(+) diff --git a/apps/opencs/model/world/idcollection.hpp b/apps/opencs/model/world/idcollection.hpp index be7891bd2..e4bb31dbe 100644 --- a/apps/opencs/model/world/idcollection.hpp +++ b/apps/opencs/model/world/idcollection.hpp @@ -265,6 +265,7 @@ namespace CSMWorld { ESXRecordT record; record.mId = id; + record.blank(); add (record); } } diff --git a/components/esm/loadglob.cpp b/components/esm/loadglob.cpp index 0335da0df..ceaa86948 100644 --- a/components/esm/loadglob.cpp +++ b/components/esm/loadglob.cpp @@ -44,6 +44,12 @@ void Global::save(ESMWriter &esm) esm.writeHNT("FLTV", mValue); } + void Global::blank() + { + mValue = 0; + mType = VT_Float; + } + bool operator== (const Global& left, const Global& right) { return left.mId==right.mId && left.mValue==right.mValue && left.mType==right.mType; diff --git a/components/esm/loadglob.hpp b/components/esm/loadglob.hpp index 5c5dafaec..6111648a6 100644 --- a/components/esm/loadglob.hpp +++ b/components/esm/loadglob.hpp @@ -23,6 +23,9 @@ struct Global void load(ESMReader &esm); void save(ESMWriter &esm); + + void blank(); + ///< Set record to default state (does not touch the ID). }; bool operator== (const Global& left, const Global& right);