forked from mirror/openmw-tes3mp
Fix moved references disappearing when modified by a plugin
This commit is contained in:
parent
d790747389
commit
dafe184220
1 changed files with 11 additions and 8 deletions
|
@ -675,14 +675,17 @@ namespace MWWorld
|
||||||
for (ESM::MovedCellRefTracker::const_iterator it = cell.mMovedRefs.begin(); it != cell.mMovedRefs.end(); ++it) {
|
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
|
// remove reference from current leased ref tracker and add it to new cell
|
||||||
ESM::MovedCellRefTracker::iterator itold = std::find(oldcell->mMovedRefs.begin(), oldcell->mMovedRefs.end(), it->mRefNum);
|
ESM::MovedCellRefTracker::iterator itold = std::find(oldcell->mMovedRefs.begin(), oldcell->mMovedRefs.end(), it->mRefNum);
|
||||||
if (itold != oldcell->mMovedRefs.end()) {
|
if (itold != oldcell->mMovedRefs.end())
|
||||||
ESM::MovedCellRef target0 = *itold;
|
{
|
||||||
ESM::Cell *wipecell = const_cast<ESM::Cell*>(search(target0.mTarget[0], target0.mTarget[1]));
|
if (it->mTarget[0] != itold->mTarget[0] || it->mTarget[1] != itold->mTarget[1])
|
||||||
|
{
|
||||||
|
ESM::Cell *wipecell = const_cast<ESM::Cell*>(search(itold->mTarget[0], itold->mTarget[1]));
|
||||||
ESM::CellRefTracker::iterator it_lease = std::find_if(wipecell->mLeasedRefs.begin(), wipecell->mLeasedRefs.end(), ESM::CellRefTrackerPredicate(it->mRefNum));
|
ESM::CellRefTracker::iterator it_lease = std::find_if(wipecell->mLeasedRefs.begin(), wipecell->mLeasedRefs.end(), ESM::CellRefTrackerPredicate(it->mRefNum));
|
||||||
if (it_lease != wipecell->mLeasedRefs.end())
|
if (it_lease != wipecell->mLeasedRefs.end())
|
||||||
wipecell->mLeasedRefs.erase(it_lease);
|
wipecell->mLeasedRefs.erase(it_lease);
|
||||||
else
|
else
|
||||||
std::cerr << "can't find " << it->mRefNum.mIndex << " " << it->mRefNum.mContentFile << " in leasedRefs " << std::endl;
|
std::cerr << "can't find " << it->mRefNum.mIndex << " " << it->mRefNum.mContentFile << " in leasedRefs " << std::endl;
|
||||||
|
}
|
||||||
*itold = *it;
|
*itold = *it;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue