|
|
|
@ -18,32 +18,68 @@ static string toStr(int i)
|
|
|
|
|
|
|
|
|
|
void ESMStore::load(ESMReader &esm)
|
|
|
|
|
{
|
|
|
|
|
set<string> missing;
|
|
|
|
|
set<string> missing;
|
|
|
|
|
|
|
|
|
|
// Loop through all records
|
|
|
|
|
while(esm.hasMoreRecs())
|
|
|
|
|
ESM::Dialogue *dialogue = 0;
|
|
|
|
|
|
|
|
|
|
// Loop through all records
|
|
|
|
|
while(esm.hasMoreRecs())
|
|
|
|
|
{
|
|
|
|
|
NAME n = esm.getRecName();
|
|
|
|
|
esm.getRecHeader();
|
|
|
|
|
NAME n = esm.getRecName();
|
|
|
|
|
esm.getRecHeader();
|
|
|
|
|
|
|
|
|
|
// Look up the record type.
|
|
|
|
|
RecListList::iterator it = recLists.find(n.val);
|
|
|
|
|
// Look up the record type.
|
|
|
|
|
RecListList::iterator it = recLists.find(n.val);
|
|
|
|
|
|
|
|
|
|
if(it == recLists.end())
|
|
|
|
|
if(it == recLists.end())
|
|
|
|
|
{
|
|
|
|
|
// Not found (this would be an error later)
|
|
|
|
|
esm.skipRecord();
|
|
|
|
|
missing.insert(n.toString());
|
|
|
|
|
continue;
|
|
|
|
|
if (n.val==ESM::REC_INFO)
|
|
|
|
|
{
|
|
|
|
|
if (dialogue)
|
|
|
|
|
{
|
|
|
|
|
ESM::DialInfo info;
|
|
|
|
|
info.load (esm);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
std::cerr << "error: info record without dialog" << std::endl;
|
|
|
|
|
esm.skipRecord();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Not found (this would be an error later)
|
|
|
|
|
esm.skipRecord();
|
|
|
|
|
missing.insert(n.toString());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Load it
|
|
|
|
|
std::string id = esm.getHNOString("NAME");
|
|
|
|
|
it->second->load(esm, id);
|
|
|
|
|
|
|
|
|
|
if (n.val==ESM::REC_DIAL)
|
|
|
|
|
{
|
|
|
|
|
RecListT<Dialogue>& recList = static_cast<RecListT<Dialogue>& > (*it->second);
|
|
|
|
|
|
|
|
|
|
id = recList.toLower (id);
|
|
|
|
|
|
|
|
|
|
// Load it
|
|
|
|
|
std::string id = esm.getHNOString("NAME");
|
|
|
|
|
it->second->load(esm, id);
|
|
|
|
|
RecListT<Dialogue>::MapType::iterator iter = recList.list.find (id);
|
|
|
|
|
|
|
|
|
|
// Insert the reference into the global lookup
|
|
|
|
|
if(!id.empty())
|
|
|
|
|
all[id] = n.val;
|
|
|
|
|
assert (iter!=recList.list.end());
|
|
|
|
|
|
|
|
|
|
dialogue = &iter->second;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
dialogue = 0;
|
|
|
|
|
|
|
|
|
|
// Insert the reference into the global lookup
|
|
|
|
|
if(!id.empty())
|
|
|
|
|
all[id] = n.val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This information isn't needed on screen. But keep the code around
|
|
|
|
|