mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 17:59:56 +00:00
Merge branch 'esm4scvr' into 'master'
ESM4: Make script local variable loading more reliable See merge request OpenMW/openmw!3967
This commit is contained in:
commit
f9e957ea0e
3 changed files with 13 additions and 17 deletions
|
@ -41,7 +41,6 @@ void ESM4::DialogInfo::load(ESM4::Reader& reader)
|
||||||
|
|
||||||
mEditorId = ESM::RefId(mId).serializeText(); // FIXME: quick workaround to use existing code
|
mEditorId = ESM::RefId(mId).serializeText(); // FIXME: quick workaround to use existing code
|
||||||
|
|
||||||
ScriptLocalVariableData localVar;
|
|
||||||
bool ignore = false;
|
bool ignore = false;
|
||||||
|
|
||||||
while (reader.getSubRecordHeader())
|
while (reader.getSubRecordHeader())
|
||||||
|
@ -125,22 +124,24 @@ void ESM4::DialogInfo::load(ESM4::Reader& reader)
|
||||||
break;
|
break;
|
||||||
case ESM::fourCC("SLSD"):
|
case ESM::fourCC("SLSD"):
|
||||||
{
|
{
|
||||||
localVar.clear();
|
ScriptLocalVariableData localVar;
|
||||||
reader.get(localVar.index);
|
reader.get(localVar.index);
|
||||||
reader.get(localVar.unknown1);
|
reader.get(localVar.unknown1);
|
||||||
reader.get(localVar.unknown2);
|
reader.get(localVar.unknown2);
|
||||||
reader.get(localVar.unknown3);
|
reader.get(localVar.unknown3);
|
||||||
reader.get(localVar.type);
|
reader.get(localVar.type);
|
||||||
reader.get(localVar.unknown4);
|
reader.get(localVar.unknown4);
|
||||||
|
mScript.localVarData.push_back(std::move(localVar));
|
||||||
// WARN: assumes SCVR will follow immediately
|
// WARN: assumes SCVR will follow immediately
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESM::fourCC("SCVR"): // assumed always pair with SLSD
|
case ESM::fourCC("SCVR"): // assumed always pair with SLSD
|
||||||
{
|
{
|
||||||
reader.getZString(localVar.variableName);
|
if (!mScript.localVarData.empty())
|
||||||
|
reader.getZString(mScript.localVarData.back().variableName);
|
||||||
mScript.localVarData.push_back(localVar);
|
else
|
||||||
|
reader.skipSubRecordData();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,6 @@ void ESM4::Script::load(ESM4::Reader& reader)
|
||||||
mId = reader.getFormIdFromHeader();
|
mId = reader.getFormIdFromHeader();
|
||||||
mFlags = reader.hdr().record.flags;
|
mFlags = reader.hdr().record.flags;
|
||||||
|
|
||||||
ScriptLocalVariableData localVar;
|
|
||||||
|
|
||||||
while (reader.getSubRecordHeader())
|
while (reader.getSubRecordHeader())
|
||||||
{
|
{
|
||||||
const ESM4::SubRecordHeader& subHdr = reader.subRecordHeader();
|
const ESM4::SubRecordHeader& subHdr = reader.subRecordHeader();
|
||||||
|
@ -117,20 +115,24 @@ void ESM4::Script::load(ESM4::Reader& reader)
|
||||||
break;
|
break;
|
||||||
case ESM::fourCC("SLSD"):
|
case ESM::fourCC("SLSD"):
|
||||||
{
|
{
|
||||||
localVar.clear();
|
ScriptLocalVariableData localVar;
|
||||||
reader.get(localVar.index);
|
reader.get(localVar.index);
|
||||||
reader.get(localVar.unknown1);
|
reader.get(localVar.unknown1);
|
||||||
reader.get(localVar.unknown2);
|
reader.get(localVar.unknown2);
|
||||||
reader.get(localVar.unknown3);
|
reader.get(localVar.unknown3);
|
||||||
reader.get(localVar.type);
|
reader.get(localVar.type);
|
||||||
reader.get(localVar.unknown4);
|
reader.get(localVar.unknown4);
|
||||||
|
mScript.localVarData.push_back(std::move(localVar));
|
||||||
// WARN: assumes SCVR will follow immediately
|
// WARN: assumes SCVR will follow immediately
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESM::fourCC("SCVR"): // assumed always pair with SLSD
|
case ESM::fourCC("SCVR"): // assumed always pair with SLSD
|
||||||
reader.getZString(localVar.variableName);
|
if (!mScript.localVarData.empty())
|
||||||
mScript.localVarData.push_back(localVar);
|
reader.getZString(mScript.localVarData.back().variableName);
|
||||||
|
else
|
||||||
|
reader.skipSubRecordData();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ESM::fourCC("SCRV"):
|
case ESM::fourCC("SCRV"):
|
||||||
{
|
{
|
||||||
|
|
|
@ -365,13 +365,6 @@ namespace ESM4
|
||||||
std::uint32_t unknown4;
|
std::uint32_t unknown4;
|
||||||
// SCVR
|
// SCVR
|
||||||
std::string variableName;
|
std::string variableName;
|
||||||
|
|
||||||
void clear()
|
|
||||||
{
|
|
||||||
index = 0;
|
|
||||||
type = 0;
|
|
||||||
variableName.clear();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ScriptDefinition
|
struct ScriptDefinition
|
||||||
|
|
Loading…
Reference in a new issue