From 18cce3a6f912e6fa56aa0d125c687e7debefc1c7 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 12 Dec 2015 22:33:14 +0100 Subject: [PATCH] Don't reset delete flag when loading reference from a save game (Fixes #2724) --- apps/openmw/mwworld/livecellref.cpp | 2 +- apps/openmw/mwworld/refdata.cpp | 4 ++-- apps/openmw/mwworld/refdata.hpp | 14 +++++++++----- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwworld/livecellref.cpp b/apps/openmw/mwworld/livecellref.cpp index bfc708185d..dcd6da431f 100644 --- a/apps/openmw/mwworld/livecellref.cpp +++ b/apps/openmw/mwworld/livecellref.cpp @@ -19,7 +19,7 @@ MWWorld::LiveCellRefBase::LiveCellRefBase(std::string type, const ESM::CellRef & void MWWorld::LiveCellRefBase::loadImp (const ESM::ObjectState& state) { mRef = state.mRef; - mData = RefData (state); + mData = RefData (state, mData.isDeletedByContentFile()); Ptr ptr (this); diff --git a/apps/openmw/mwworld/refdata.cpp b/apps/openmw/mwworld/refdata.cpp index 997b3fc94b..6a127085cc 100644 --- a/apps/openmw/mwworld/refdata.cpp +++ b/apps/openmw/mwworld/refdata.cpp @@ -49,8 +49,8 @@ namespace MWWorld { } - RefData::RefData (const ESM::ObjectState& objectState) - : mBaseNode(0), mDeleted(false), + RefData::RefData (const ESM::ObjectState& objectState, bool deleted) + : mBaseNode(0), mDeleted(deleted), mEnabled (objectState.mEnabled != 0), mCount (objectState.mCount), mPosition (objectState.mPosition), diff --git a/apps/openmw/mwworld/refdata.hpp b/apps/openmw/mwworld/refdata.hpp index 19c31a14b5..fbb951c5af 100644 --- a/apps/openmw/mwworld/refdata.hpp +++ b/apps/openmw/mwworld/refdata.hpp @@ -30,10 +30,14 @@ namespace MWWorld MWScript::Locals mLocals; - bool mDeleted; // separate delete flag used for deletion by a content file - bool mEnabled; - int mCount; // 0: deleted + /// separate delete flag used for deletion by a content file + /// @note not stored in the save game file. + bool mDeleted; + bool mEnabled; + + /// 0: deleted + int mCount; ESM::Position mPosition; @@ -51,10 +55,10 @@ namespace MWWorld /// @param cellRef Used to copy constant data such as position into this class where it can /// be altered without affecting the original data. This makes it possible - /// to reset the position as the orignal data is still held in the CellRef + /// to reset the position as the original data is still held in the CellRef RefData (const ESM::CellRef& cellRef); - RefData (const ESM::ObjectState& objectState); + RefData (const ESM::ObjectState& objectState, bool deleted); ///< Ignores local variables and custom data (not enough context available here to /// perform these operations).