Update CreatureLib.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-05-27 17:26:25 +02:00
parent 0d111739f4
commit f42ce8865d
53 changed files with 316 additions and 269 deletions

View File

@@ -82,8 +82,8 @@ void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg)
RegisterTypes();
RegisterExceptionRoutines(_engine);
auto staticLib = library->GetStaticLib();
_engine->RegisterGlobalProperty("const StaticLibrary@ StaticLib", &staticLib);
auto& staticLib = library->GetStaticLib();
_engine->RegisterGlobalProperty("const StaticLibrary@ StaticLib", (void*)staticLib.get());
_contextPool = new ContextPool(_engine);
}
@@ -123,7 +123,7 @@ void AngelScriptResolver::MessageCallback(const asSMessageInfo* msg, void* param
}
CreatureLib::Battling::Script* AngelScriptResolver::LoadScript(ScriptCategory category, const ConstString& scriptName) {
Dictionary<ConstString, AngelScriptTypeInfo*> innerDb;
ArbUt::Dictionary<ConstString, AngelScriptTypeInfo*> innerDb;
if (!_typeDatabase.TryGet(category, innerDb)) {
_typeDatabase.Insert(category, innerDb);
return nullptr;
@@ -156,14 +156,14 @@ void AngelScriptResolver::FinalizeModule() {
for (size_t m = 0; m < metadata.size(); m++) {
auto data = metadata[m];
if (std::regex_match(data, base_match, metadataMatcher)) {
auto metadataKind = Arbutils::CaseInsensitiveConstString(base_match[1].str());
auto metadataKind = ArbUt::CaseInsensitiveConstString(base_match[1].str());
auto metadataVariables = base_match[2].str();
if (!std::regex_match(metadataVariables, base_match, variableMatcher)) {
continue;
}
ConstString effectName;
for (size_t variableIndex = 1; variableIndex < base_match.size(); variableIndex += 2) {
if (Arbutils::CaseInsensitiveConstString::GetHash(base_match[variableIndex]) == "effect"_cnc) {
if (ArbUt::CaseInsensitiveConstString::GetHash(base_match[variableIndex]) == "effect"_cnc) {
auto val = base_match[variableIndex + 1].str();
effectName = ConstString(val);
}
@@ -296,17 +296,17 @@ void AngelScriptResolver::LoadByteCodeFromMemory(uint8_t* byte, size_t size) {
delete stream;
}
void AngelScriptResolver::InitializeByteCode(
asIBinaryStream* stream, const Dictionary<ScriptCategory, Dictionary<ConstString, uint32_t>>& types) {
asIBinaryStream* stream, const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ConstString, uint32_t>>& types) {
auto typeCount = _mainModule->GetObjectTypeCount();
Dictionary<uint32_t, asITypeInfo*> objectTypes;
ArbUt::Dictionary<uint32_t, asITypeInfo*> objectTypes;
for (asUINT i = 0; i < typeCount; i++) {
auto t = _mainModule->GetObjectTypeByIndex(i);
objectTypes.Insert(ConstString::GetHash(t->GetName()), t);
}
Dictionary<ScriptCategory, Dictionary<ConstString, AngelScriptTypeInfo*>> typeDatabase;
ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ConstString, AngelScriptTypeInfo*>> typeDatabase;
for (const auto& innerDb : types) {
Dictionary<ConstString, AngelScriptTypeInfo*> newInnerDb;
ArbUt::Dictionary<ConstString, AngelScriptTypeInfo*> newInnerDb;
for (const auto& val : innerDb.second) {
auto decl = val.second;
auto type = objectTypes[decl];