Support serializing item use scripts.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2021-03-07 18:11:18 +01:00
parent 27dd8a8202
commit 7216d9d71b
2 changed files with 34 additions and 9 deletions

View File

@@ -14,7 +14,8 @@ protected:
public:
virtual void WriteTypes(
const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo*>>& types) {
const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo*>>& types,
const ArbUt::Dictionary<ArbUt::StringView, asITypeInfo*> itemUseTypes) {
// We serialize our types in the format
// "[category(byte)][name(str)]\2[decl(str)]\2[name(str)]\2[decl(str)]\1[category(byte)]...."
@@ -37,6 +38,22 @@ public:
// Write the divider between categories.
Write("\1", sizeof(char));
}
categoryArr[0] = (ScriptCategory)-1;
Write(categoryArr, sizeof(ScriptCategory));
for (const auto& inner : itemUseTypes) {
// Write the script name
Write(inner.first.c_str(), sizeof(char) * inner.first.Length());
// Write the divider
Write("\2", sizeof(char));
// Write the declaration of the script
auto decl = inner.second->GetName();
Write(decl, sizeof(char) * strlen(decl));
// Write another divider.
Write("\2", sizeof(char));
}
// Write the divider between categories.
Write("\1", sizeof(char));
}
virtual ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, uint32_t>> ReadTypes() {
_angelScriptBound = SIZE_MAX;