Fixes #1234: Store dynamic record counter in savegame to prevent name clashes

deque
scrawl 11 years ago
parent 07d9845aa0
commit 041319c43e

@ -314,6 +314,7 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
case ESM::REC_PLAY:
case ESM::REC_CSTA:
case ESM::REC_WTHR:
case ESM::REC_DYNA:
MWBase::Environment::get().getWorld()->readRecord (reader, n.val, contentFileMap);
break;

@ -141,8 +141,8 @@ void ESMStore::setUp()
int ESMStore::countSavedGameRecords() const
{
return
mPotions.getDynamicSize()
return 1 // DYNA (dynamic name counter)
+mPotions.getDynamicSize()
+mArmors.getDynamicSize()
+mBooks.getDynamicSize()
+mClasses.getDynamicSize()
@ -155,6 +155,13 @@ void ESMStore::setUp()
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);
mArmors.write (writer, progress);
mBooks.write (writer, progress);
@ -197,6 +204,11 @@ void ESMStore::setUp()
return true;
case ESM::REC_DYNA:
reader.getSubNameIs("COUN");
reader.getHT(mDynamicCount);
return true;
default:
return false;

@ -100,6 +100,7 @@ enum RecNameInts
REC_DIAS = 0x53414944,
REC_WTHR = 0x52485457,
REC_KEYS = FourCC<'K','E','Y','S'>::value,
REC_DYNA = FourCC<'D','Y','N','A'>::value,
// format 1
REC_FILT = 0x544C4946

Loading…
Cancel
Save