forked from mirror/openmw-tes3mp
Fixes #1234: Store dynamic record counter in savegame to prevent name clashes
This commit is contained in:
parent
07d9845aa0
commit
041319c43e
3 changed files with 16 additions and 2 deletions
|
@ -314,6 +314,7 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
|
||||||
case ESM::REC_PLAY:
|
case ESM::REC_PLAY:
|
||||||
case ESM::REC_CSTA:
|
case ESM::REC_CSTA:
|
||||||
case ESM::REC_WTHR:
|
case ESM::REC_WTHR:
|
||||||
|
case ESM::REC_DYNA:
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld()->readRecord (reader, n.val, contentFileMap);
|
MWBase::Environment::get().getWorld()->readRecord (reader, n.val, contentFileMap);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -141,8 +141,8 @@ void ESMStore::setUp()
|
||||||
|
|
||||||
int ESMStore::countSavedGameRecords() const
|
int ESMStore::countSavedGameRecords() const
|
||||||
{
|
{
|
||||||
return
|
return 1 // DYNA (dynamic name counter)
|
||||||
mPotions.getDynamicSize()
|
+mPotions.getDynamicSize()
|
||||||
+mArmors.getDynamicSize()
|
+mArmors.getDynamicSize()
|
||||||
+mBooks.getDynamicSize()
|
+mBooks.getDynamicSize()
|
||||||
+mClasses.getDynamicSize()
|
+mClasses.getDynamicSize()
|
||||||
|
@ -155,6 +155,13 @@ void ESMStore::setUp()
|
||||||
|
|
||||||
void ESMStore::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
void ESMStore::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||||
{
|
{
|
||||||
|
writer.startRecord(ESM::REC_DYNA);
|
||||||
|
writer.startSubRecord("COUN");
|
||||||
|
writer.writeT(mDynamicCount);
|
||||||
|
writer.endRecord("COUN");
|
||||||
|
writer.endRecord(ESM::REC_DYNA);
|
||||||
|
progress.increaseProgress();
|
||||||
|
|
||||||
mPotions.write (writer, progress);
|
mPotions.write (writer, progress);
|
||||||
mArmors.write (writer, progress);
|
mArmors.write (writer, progress);
|
||||||
mBooks.write (writer, progress);
|
mBooks.write (writer, progress);
|
||||||
|
@ -197,6 +204,11 @@ void ESMStore::setUp()
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case ESM::REC_DYNA:
|
||||||
|
reader.getSubNameIs("COUN");
|
||||||
|
reader.getHT(mDynamicCount);
|
||||||
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -100,6 +100,7 @@ enum RecNameInts
|
||||||
REC_DIAS = 0x53414944,
|
REC_DIAS = 0x53414944,
|
||||||
REC_WTHR = 0x52485457,
|
REC_WTHR = 0x52485457,
|
||||||
REC_KEYS = FourCC<'K','E','Y','S'>::value,
|
REC_KEYS = FourCC<'K','E','Y','S'>::value,
|
||||||
|
REC_DYNA = FourCC<'D','Y','N','A'>::value,
|
||||||
|
|
||||||
// format 1
|
// format 1
|
||||||
REC_FILT = 0x544C4946
|
REC_FILT = 0x544C4946
|
||||||
|
|
Loading…
Reference in a new issue