Added support for loading dependencies of EVNT and STRG

This commit is contained in:
parax0
2016-07-27 03:24:15 -06:00
parent 7f2cac6216
commit 11a7b86120
5 changed files with 103 additions and 30 deletions

View File

@@ -41,6 +41,33 @@ public:
return TWideString();
}
CDependencyTree* BuildDependencyTree() const
{
// The only dependencies STRGs have is they can reference FONTs with the &font=; formatting tag
CDependencyTree *pTree = new CDependencyTree(ID());
EIDLength IDLength = (Game() <= eEchoes ? e32Bit : e64Bit);
for (u32 iLang = 0; iLang < mLangTables.size(); iLang++)
{
const SLangTable& rkTable = mLangTables[iLang];
for (u32 iStr = 0; iStr < rkTable.Strings.size(); iStr++)
{
static const TWideString skTag = L"&font=";
const TWideString& rkStr = rkTable.Strings[iStr];
for (u32 FontIdx = rkStr.IndexOfPhrase(*skTag); FontIdx != -1; FontIdx = rkStr.IndexOfPhrase(*skTag, FontIdx + 1))
{
u32 IDStart = FontIdx + skTag.Size();
TWideString StrFontID = rkStr.SubString(IDStart, IDLength * 2);
pTree->AddDependency( CAssetID::FromString(StrFontID) );
}
}
}
return pTree;
}
};
#endif // CSTRINGTABLE_H