mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-06 16:15:33 +00:00
Fix some uninitialized data written to savegames
This commit is contained in:
parent
e274314548
commit
8a8ecce1e5
4 changed files with 22 additions and 4 deletions
|
@ -201,6 +201,13 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
|
|||
writer.addMaster (*iter, 0); // not using the size information anyway -> use value of 0
|
||||
|
||||
writer.setFormat (ESM::Header::CurrentFormat);
|
||||
|
||||
// all unused
|
||||
writer.setVersion(0);
|
||||
writer.setType(0);
|
||||
writer.setAuthor("");
|
||||
writer.setDescription("");
|
||||
|
||||
int recordCount = 1 // saved game header
|
||||
+MWBase::Environment::get().getJournal()->countSavedGameRecords()
|
||||
+MWBase::Environment::get().getWorld()->countSavedGameRecords()
|
||||
|
|
|
@ -108,13 +108,13 @@ void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory) cons
|
|||
esm.writeHNT("NAM9", mGoldValue);
|
||||
}
|
||||
|
||||
if (mTeleport && !inInventory)
|
||||
if (!inInventory && mTeleport)
|
||||
{
|
||||
esm.writeHNT("DODT", mDoorDest);
|
||||
esm.writeHNOCString("DNAM", mDestCell);
|
||||
}
|
||||
|
||||
if (mLockLevel != 0 && !inInventory) {
|
||||
if (!inInventory && mLockLevel != 0) {
|
||||
esm.writeHNT("FLTV", mLockLevel);
|
||||
}
|
||||
|
||||
|
@ -127,13 +127,13 @@ void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory) cons
|
|||
if (mReferenceBlocked != -1)
|
||||
esm.writeHNT("UNAM", mReferenceBlocked);
|
||||
|
||||
if (mFltv != 0 && !inInventory)
|
||||
if (!inInventory && mFltv != 0)
|
||||
esm.writeHNT("FLTV", mFltv);
|
||||
|
||||
if (!inInventory)
|
||||
esm.writeHNT("DATA", mPos, 24);
|
||||
|
||||
if (mNam0 != 0 && !inInventory)
|
||||
if (!inInventory && mNam0 != 0)
|
||||
esm.writeHNT("NAM0", mNam0);
|
||||
}
|
||||
|
||||
|
@ -158,6 +158,7 @@ void ESM::CellRef::blank()
|
|||
mReferenceBlocked = 0;
|
||||
mFltv = 0;
|
||||
mNam0 = 0;
|
||||
mTeleport = false;
|
||||
|
||||
for (int i=0; i<3; ++i)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,11 @@ namespace ESM
|
|||
mHeader.mData.version = ver;
|
||||
}
|
||||
|
||||
void ESMWriter::setType(int type)
|
||||
{
|
||||
mHeader.mData.type = type;
|
||||
}
|
||||
|
||||
void ESMWriter::setAuthor(const std::string& auth)
|
||||
{
|
||||
mHeader.mData.author.assign (auth);
|
||||
|
|
|
@ -25,10 +25,15 @@ class ESMWriter
|
|||
ESMWriter();
|
||||
|
||||
unsigned int getVersion() const;
|
||||
|
||||
// Set various header data (ESM::Header::Data). All of the below functions must be called before writing,
|
||||
// otherwise this data will be left uninitialized.
|
||||
void setVersion(unsigned int ver = 0x3fa66666);
|
||||
void setType(int type);
|
||||
void setEncoder(ToUTF8::Utf8Encoder *encoding);
|
||||
void setAuthor(const std::string& author);
|
||||
void setDescription(const std::string& desc);
|
||||
|
||||
// Set the record count for writing it in the file header
|
||||
void setRecordCount (int count);
|
||||
// Counts how many records we have actually written.
|
||||
|
|
Loading…
Reference in a new issue