From 68d6b6b2f3eeea910e6490a45d826db7fd43e8c3 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 11 Jun 2014 21:56:10 +0200 Subject: [PATCH] Cell merge fix (reference context position was not saved correctly) --- apps/openmw/mwworld/store.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp index 19b204073..fdeb290e5 100644 --- a/apps/openmw/mwworld/store.cpp +++ b/apps/openmw/mwworld/store.cpp @@ -70,13 +70,15 @@ void Store::load(ESM::ESMReader &esm, const std::string &id) ESM::Cell *oldcell = const_cast(search(cell.getGridX(), cell.getGridY())); if (oldcell) { // merge new cell into old cell - // push the new references on the list of references to manage (saveContext = true) oldcell->mData = cell.mData; - oldcell->loadCell(esm, true); + oldcell->loadCell(esm, false); // handle moved ref (MVRF) subrecords handleMovedCellRefs (esm, &cell); + // push the new references on the list of references to manage + oldcell->postLoad(esm); + // merge lists of leased references, use newer data in case of conflict for (ESM::MovedCellRefTracker::const_iterator it = cell.mMovedRefs.begin(); it != cell.mMovedRefs.end(); ++it) { // remove reference from current leased ref tracker and add it to new cell @@ -96,11 +98,14 @@ void Store::load(ESM::ESMReader &esm, const std::string &id) } else { // spawn a new cell - cell.loadCell(esm, true); + cell.loadCell(esm, false); // handle moved ref (MVRF) subrecords handleMovedCellRefs (esm, &cell); + // push the new references on the list of references to manage + cell.postLoad(esm); + mExt[std::make_pair(cell.mData.mX, cell.mData.mY)] = cell; } }