Optimize journal data saving
Here is how we store known topics info:
for (TTopicIter iter (mTopics.begin()); iter!=mTopics.end(); ++iter)
{
const Topic& topic = iter->second;
for (Topic::TEntryIter entryIter (topic.begin()); entryIter!=topic.end(); ++entryIter)
{
ESM::JournalEntry entry;
entry.mType = ESM::JournalEntry::Type_Topic;
entry.mTopic = topic.getTopic();
entryIter->write (entry);
writer.startRecord (ESM::REC_JOUR);
entry.save (writer);
writer.endRecord (ESM::REC_JOUR);
}
}
What is wrong here:
- There is no need to store
mType
andmTopic
for every entry. We can organize this data in a more efficient way. - I am not sure if we really need to store the whole text just for every topic info and actor's name instead of actor ID. I examined Morrowind's saves, and it seems it stores text only for journal itself as a single HTML page. For dialogue topics (including quests) Morrowind stores only topic name and list of pairs "topic info ID -> target actor ID" (INAM/ACDT subrecords) in the DIAL record.