mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 20:06:40 +00:00
A different implementation to MR 1051 to fix Issue #6067.
This MR doesn't delete the original record, but instead the original record is updated with the moved record when loading. Issue #4752 is no longer addressed in this MR.
This commit is contained in:
parent
7264a10c07
commit
b2bd97f283
3 changed files with 38 additions and 3 deletions
|
@ -9,7 +9,6 @@
|
||||||
Bug #4203: Resurrecting an actor should close the loot GUI
|
Bug #4203: Resurrecting an actor should close the loot GUI
|
||||||
Bug #4700: Editor: Incorrect command implementation
|
Bug #4700: Editor: Incorrect command implementation
|
||||||
Bug #4744: Invisible particles must still be processed
|
Bug #4744: Invisible particles must still be processed
|
||||||
Bug #4752: UpdateCellCommand doesn't undo properly
|
|
||||||
Bug #5100: Persuasion doesn't always clamp the resulting disposition
|
Bug #5100: Persuasion doesn't always clamp the resulting disposition
|
||||||
Bug #5120: Scripted object spawning updates physics system
|
Bug #5120: Scripted object spawning updates physics system
|
||||||
Bug #5379: Wandering NPCs falling through cantons
|
Bug #5379: Wandering NPCs falling through cantons
|
||||||
|
|
|
@ -89,12 +89,48 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool
|
||||||
else
|
else
|
||||||
ref.mCell = cell2.mId;
|
ref.mCell = cell2.mId;
|
||||||
|
|
||||||
|
if (ref.mRefNum.mContentFile != -1 && !base)
|
||||||
|
{
|
||||||
|
ref.mRefNum.mContentFile = ref.mRefNum.mIndex >> 24;
|
||||||
|
ref.mRefNum.mIndex &= 0x00ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int refNum = (ref.mRefNum.mIndex & 0x00ffffff) |
|
unsigned int refNum = (ref.mRefNum.mIndex & 0x00ffffff) |
|
||||||
(ref.mRefNum.hasContentFile() ? ref.mRefNum.mContentFile : 0xff) << 24;
|
(ref.mRefNum.hasContentFile() ? ref.mRefNum.mContentFile : 0xff) << 24;
|
||||||
|
|
||||||
std::map<unsigned int, unsigned int>::iterator iter = cache.find(refNum);
|
std::map<unsigned int, unsigned int>::iterator iter = cache.find(refNum);
|
||||||
|
|
||||||
if (ref.mRefNum.mContentFile != -1 && !base) ref.mRefNum.mContentFile = ref.mRefNum.mIndex >> 24;
|
if (isMoved)
|
||||||
|
{
|
||||||
|
if (iter == cache.end())
|
||||||
|
{
|
||||||
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Cell,
|
||||||
|
mCells.getId(cellIndex));
|
||||||
|
|
||||||
|
messages.add(id, "Attempt to move a non-existent reference - RefNum index "
|
||||||
|
+ std::to_string(ref.mRefNum.mIndex) + ", refID " + ref.mRefID + ", content file index "
|
||||||
|
+ std::to_string(ref.mRefNum.mContentFile),
|
||||||
|
/*hint*/"",
|
||||||
|
CSMDoc::Message::Severity_Warning);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = getIntIndex(iter->second);
|
||||||
|
|
||||||
|
// ensure we have the same record id for setRecord()
|
||||||
|
ref.mId = getRecord(index).get().mId;
|
||||||
|
ref.mIdNum = extractIdNum(ref.mId);
|
||||||
|
|
||||||
|
std::unique_ptr<Record<CellRef> > record(new Record<CellRef>);
|
||||||
|
// TODO: check whether a base record be moved
|
||||||
|
record->mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly;
|
||||||
|
(base ? record->mBase : record->mModified) = std::move(ref);
|
||||||
|
|
||||||
|
// overwrite original record
|
||||||
|
setRecord(index, std::move(record));
|
||||||
|
|
||||||
|
continue; // NOTE: assumed moved references are not deleted at the same time
|
||||||
|
}
|
||||||
|
|
||||||
if (isDeleted)
|
if (isDeleted)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace CSMWorld
|
||||||
class RefCollection : public Collection<CellRef>
|
class RefCollection : public Collection<CellRef>
|
||||||
{
|
{
|
||||||
Collection<Cell>& mCells;
|
Collection<Cell>& mCells;
|
||||||
std::map<unsigned int, int> mRefIndex;
|
std::map<unsigned int, int> mRefIndex; // CellRef index keyed by CSMWorld::CellRef::mIdNum
|
||||||
|
|
||||||
int mNextId;
|
int mNextId;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue