Make AngelScript effect attributes case insensitive.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
aa1e6ae5b3
commit
af737cf8b8
|
@ -156,14 +156,14 @@ void AngelScripResolver::FinalizeModule() {
|
||||||
for (size_t m = 0; m < metadata.size(); m++) {
|
for (size_t m = 0; m < metadata.size(); m++) {
|
||||||
auto data = metadata[m];
|
auto data = metadata[m];
|
||||||
if (std::regex_match(data, base_match, metadataMatcher)) {
|
if (std::regex_match(data, base_match, metadataMatcher)) {
|
||||||
auto metadataKind = base_match[1].str();
|
auto metadataKind = Arbutils::CaseInsensitiveConstString(base_match[1].str());
|
||||||
auto metadataVariables = base_match[2].str();
|
auto metadataVariables = base_match[2].str();
|
||||||
if (!std::regex_match(metadataVariables, base_match, variableMatcher)) {
|
if (!std::regex_match(metadataVariables, base_match, variableMatcher)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ConstString effectName;
|
ConstString effectName;
|
||||||
for (size_t variableIndex = 1; variableIndex < base_match.size(); variableIndex += 2) {
|
for (size_t variableIndex = 1; variableIndex < base_match.size(); variableIndex += 2) {
|
||||||
if (base_match[variableIndex] == "effect") {
|
if (Arbutils::CaseInsensitiveConstString::GetHash(base_match[variableIndex]) == "effect"_cnc) {
|
||||||
auto val = base_match[variableIndex + 1].str();
|
auto val = base_match[variableIndex + 1].str();
|
||||||
effectName = ConstString(val);
|
effectName = ConstString(val);
|
||||||
}
|
}
|
||||||
|
@ -171,28 +171,35 @@ void AngelScripResolver::FinalizeModule() {
|
||||||
if (effectName.Empty()) {
|
if (effectName.Empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
switch (metadataKind) {
|
||||||
if (metadataKind == "Move") {
|
case "Move"_cnc:
|
||||||
_typeDatabase[ScriptCategory::Attack].Insert(effectName,
|
_typeDatabase[ScriptCategory::Attack].Insert(effectName,
|
||||||
new AngelScriptTypeInfo(effectName, typeInfo));
|
new AngelScriptTypeInfo(effectName, typeInfo));
|
||||||
} else if (metadataKind == "Pokemon") {
|
break;
|
||||||
_typeDatabase[ScriptCategory::Creature].Insert(effectName,
|
case "Pokemon"_cnc:
|
||||||
|
_typeDatabase[ScriptCategory::Creature].Insert(effectName,
|
||||||
|
new AngelScriptTypeInfo(effectName, typeInfo));
|
||||||
|
break;
|
||||||
|
case "Ability"_cnc:
|
||||||
|
_typeDatabase[ScriptCategory::Talent].Insert(effectName,
|
||||||
|
new AngelScriptTypeInfo(effectName, typeInfo));
|
||||||
|
break;
|
||||||
|
case "Status"_cnc:
|
||||||
|
_typeDatabase[ScriptCategory::Status].Insert(effectName,
|
||||||
|
new AngelScriptTypeInfo(effectName, typeInfo));
|
||||||
|
break;
|
||||||
|
case "Battle"_cnc:
|
||||||
|
_typeDatabase[ScriptCategory::Battle].Insert(effectName,
|
||||||
|
new AngelScriptTypeInfo(effectName, typeInfo));
|
||||||
|
break;
|
||||||
|
case "Side"_cnc:
|
||||||
|
_typeDatabase[ScriptCategory::Side].Insert(effectName,
|
||||||
new AngelScriptTypeInfo(effectName, typeInfo));
|
new AngelScriptTypeInfo(effectName, typeInfo));
|
||||||
} else if (metadataKind == "Ability") {
|
break;
|
||||||
_typeDatabase[ScriptCategory::Talent].Insert(effectName,
|
case "Weather"_cnc:
|
||||||
new AngelScriptTypeInfo(effectName, typeInfo));
|
_typeDatabase[static_cast<ScriptCategory>(PkmnScriptCategory::Weather)].Insert(
|
||||||
} else if (metadataKind == "Status") {
|
effectName, new AngelScriptTypeInfo(effectName, typeInfo));
|
||||||
_typeDatabase[ScriptCategory::Status].Insert(effectName,
|
break;
|
||||||
new AngelScriptTypeInfo(effectName, typeInfo));
|
|
||||||
} else if (metadataKind == "Battle") {
|
|
||||||
_typeDatabase[ScriptCategory::Battle].Insert(effectName,
|
|
||||||
new AngelScriptTypeInfo(effectName, typeInfo));
|
|
||||||
} else if (metadataKind == "Side") {
|
|
||||||
_typeDatabase[ScriptCategory::Side].Insert(effectName,
|
|
||||||
new AngelScriptTypeInfo(effectName, typeInfo));
|
|
||||||
} else if (metadataKind == "Weather") {
|
|
||||||
_typeDatabase[static_cast<ScriptCategory>(PkmnScriptCategory::Weather)].Insert(effectName,
|
|
||||||
new AngelScriptTypeInfo(effectName, typeInfo));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,8 +243,8 @@ void AngelScripResolver::LoadByteCodeFromMemory(
|
||||||
InitializeByteCode(stream, types);
|
InitializeByteCode(stream, types);
|
||||||
delete stream;
|
delete stream;
|
||||||
}
|
}
|
||||||
void AngelScripResolver::InitializeByteCode(asIBinaryStream* stream,
|
void AngelScripResolver::InitializeByteCode(
|
||||||
const Dictionary<ScriptCategory, Dictionary<ConstString, const char*>>& types) {
|
asIBinaryStream* stream, const Dictionary<ScriptCategory, Dictionary<ConstString, const char*>>& types) {
|
||||||
int result = _mainModule->LoadByteCode(stream);
|
int result = _mainModule->LoadByteCode(stream);
|
||||||
Assert(result == asSUCCESS);
|
Assert(result == asSUCCESS);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue