Skip to content

Commit

Permalink
Merge branch 'theeditorisjustanotherengine' into 'master'
Browse files Browse the repository at this point in the history
Use ESM::ReadersCache in the editor

Closes #7896

See merge request OpenMW/openmw!4111
  • Loading branch information
magicaldave committed May 21, 2024
2 parents cd116eb + 77d5545 commit c87eaef
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 123 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
Bug #7872: Region sounds use wrong odds
Bug #7886: Equip and unequip animations can't share the animation track section
Bug #7887: Editor: Mismatched reported script data size and actual data size causes a crash during save
Bug #7896: Editor: Loading cellrefs incorrectly transforms Refnums, causing load failures
Bug #7898: Editor: Invalid reference scales are allowed
Bug #7899: Editor: Doors can't be unlocked
Bug #7901: Editor: Teleport-related fields shouldn't be editable if a ref does not teleport
Expand Down
9 changes: 1 addition & 8 deletions apps/opencs/model/doc/loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@

#include "document.hpp"

CSMDoc::Loader::Stage::Stage()
: mFile(0)
, mRecordsLoaded(0)
, mRecordsLeft(false)
{
}

CSMDoc::Loader::Loader()
: mShouldStop(false)
{
Expand Down Expand Up @@ -105,7 +98,7 @@ void CSMDoc::Loader::load()

if (iter->second.mFile < size) // start loading the files
{
std::filesystem::path path = document->getContentFiles()[iter->second.mFile];
const std::filesystem::path& path = document->getContentFiles()[iter->second.mFile];

int steps = document->getData().startLoading(path, iter->second.mFile != editedIndex, /*project*/ false);
iter->second.mRecordsLeft = true;
Expand Down
8 changes: 3 additions & 5 deletions apps/opencs/model/doc/loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ namespace CSMDoc

struct Stage
{
int mFile;
int mRecordsLoaded;
bool mRecordsLeft;

Stage();
int mFile = 0;
int mRecordsLoaded = 0;
bool mRecordsLeft = false;
};

QMutex mMutex;
Expand Down
5 changes: 2 additions & 3 deletions apps/opencs/model/doc/savingstages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,8 @@ void CSMDoc::WriteCellCollectionStage::writeReferences(
{
CSMWorld::CellRef refRecord = ref.get();

// Check for uninitialized content file
if (!refRecord.mRefNum.hasContentFile())
refRecord.mRefNum.mContentFile = 0;
// -1 is the current file, saved indices are 1-based
refRecord.mRefNum.mContentFile++;

// recalculate the ref's cell location
std::ostringstream stream;
Expand Down
2 changes: 1 addition & 1 deletion apps/opencs/model/tools/mergestages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void CSMTools::MergeReferencesStage::perform(int stage, CSMDoc::Messages& messag
ref.mOriginalCell = ref.mCell;

ref.mRefNum.mIndex = mIndex[ref.mCell]++;
ref.mRefNum.mContentFile = 0;
ref.mRefNum.mContentFile = -1;
ref.mNew = false;

mState.mTarget->getData().getReferences().appendRecord(std::make_unique<CSMWorld::Record<CSMWorld::CellRef>>(
Expand Down
Loading

0 comments on commit c87eaef

Please sign in to comment.