Skip to content

Commit

Permalink
Merge branch 'init_field' into 'master'
Browse files Browse the repository at this point in the history
Init structs to make sure that we do not store a random data

See merge request OpenMW/openmw!3400
  • Loading branch information
psi29a committed Sep 5, 2023
2 parents 93aebbe + 5d51f3e commit 690a237
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions apps/openmw/mwworld/worldmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,20 @@ namespace MWWorld

const ESM::Cell* createEsmCell(ESM::ExteriorCellLocation location, ESMStore& store)
{
ESM::Cell record;
ESM::Cell record = {};
record.mData.mFlags = ESM::Cell::HasWater;
record.mData.mX = location.mX;
record.mData.mY = location.mY;
record.mWater = 0;
record.mMapColor = 0;
record.updateId();
return store.insert(record);
}

const ESM4::Cell* createEsm4Cell(ESM::ExteriorCellLocation location, ESMStore& store)
{
ESM4::Cell record;
ESM4::Cell record = {};
record.mParent = location.mWorldspace;
record.mX = location.mX;
record.mY = location.mY;
record.mCellFlags = 0;
return store.insert(record);
}

Expand Down
4 changes: 2 additions & 2 deletions components/esm4/reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ namespace ESM4
, currCellGrid(FormId{ 0, 0 })
, cellGridValid(false)
{
subRecordHeader.typeId = 0;
subRecordHeader.dataSize = 0;
recordHeader = {};
subRecordHeader = {};
}

Reader::Reader(Files::IStreamPtr&& esmStream, const std::filesystem::path& filename, VFS::Manager const* vfs,
Expand Down

0 comments on commit 690a237

Please sign in to comment.