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

This commit is contained in:
2020-07-04 15:50:30 +02:00
parent 698bc62b47
commit 7f1bc252ba
49 changed files with 207 additions and 237 deletions

View File

@@ -124,8 +124,9 @@ void AngelScriptResolver::MessageCallback(const asSMessageInfo* msg, void* param
printf("%s (%d, %d) : %s : %s\n", msg->section, msg->row, msg->col, type, msg->message);
}
CreatureLib::Battling::Script* AngelScriptResolver::LoadScript(ScriptCategory category, const ConstString& scriptName) {
ArbUt::Dictionary<ConstString, AngelScriptTypeInfo*> innerDb;
CreatureLib::Battling::Script* AngelScriptResolver::LoadScript(ScriptCategory category,
const ArbUt::StringView& scriptName) {
ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo*> innerDb;
if (!_typeDatabase.TryGet(category, innerDb)) {
innerDb.Insert(scriptName, nullptr);
_typeDatabase.Insert(category, innerDb);
@@ -159,16 +160,17 @@ 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 = ArbUt::CaseInsensitiveConstString(base_match[1].str());
auto mt = base_match[1].str();
auto metadataKind = ArbUt::StringView(mt.c_str(), mt.length());
auto metadataVariables = base_match[2].str();
if (!std::regex_match(metadataVariables, base_match, variableMatcher)) {
continue;
}
ConstString effectName;
ArbUt::StringView effectName;
for (size_t variableIndex = 1; variableIndex < base_match.size(); variableIndex += 2) {
if (ArbUt::CaseInsensitiveConstString::GetHash(base_match[variableIndex]) == "effect"_cnc) {
if (ArbUt::StringView::CalculateHash(base_match[variableIndex].str().c_str()) == "effect"_cnc) {
auto val = base_match[variableIndex + 1].str();
effectName = ConstString(val);
effectName = ArbUt::StringView(val.c_str(), val.length());
}
}
if (effectName.Empty()) {
@@ -299,17 +301,18 @@ void AngelScriptResolver::LoadByteCodeFromMemory(uint8_t* byte, size_t size) {
delete stream;
}
void AngelScriptResolver::InitializeByteCode(
asIBinaryStream* stream, const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ConstString, uint32_t>>& types) {
asIBinaryStream* stream,
const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, uint32_t>>& types) {
auto typeCount = _mainModule->GetObjectTypeCount();
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);
objectTypes.Insert(ArbUt::StringView::CalculateHash(t->GetName()), t);
}
ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ConstString, AngelScriptTypeInfo*>> typeDatabase;
ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo*>> typeDatabase;
for (const auto& innerDb : types) {
ArbUt::Dictionary<ConstString, AngelScriptTypeInfo*> newInnerDb;
ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo*> newInnerDb;
for (const auto& val : innerDb.second) {
auto decl = val.second;
auto type = objectTypes[decl];