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++) {
|
||||
auto data = metadata[m];
|
||||
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();
|
||||
if (!std::regex_match(metadataVariables, base_match, variableMatcher)) {
|
||||
continue;
|
||||
}
|
||||
ConstString effectName;
|
||||
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();
|
||||
effectName = ConstString(val);
|
||||
}
|
||||
|
@ -171,28 +171,35 @@ void AngelScripResolver::FinalizeModule() {
|
|||
if (effectName.Empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (metadataKind == "Move") {
|
||||
switch (metadataKind) {
|
||||
case "Move"_cnc:
|
||||
_typeDatabase[ScriptCategory::Attack].Insert(effectName,
|
||||
new AngelScriptTypeInfo(effectName, typeInfo));
|
||||
} else if (metadataKind == "Pokemon") {
|
||||
break;
|
||||
case "Pokemon"_cnc:
|
||||
_typeDatabase[ScriptCategory::Creature].Insert(effectName,
|
||||
new AngelScriptTypeInfo(effectName, typeInfo));
|
||||
} else if (metadataKind == "Ability") {
|
||||
break;
|
||||
case "Ability"_cnc:
|
||||
_typeDatabase[ScriptCategory::Talent].Insert(effectName,
|
||||
new AngelScriptTypeInfo(effectName, typeInfo));
|
||||
} else if (metadataKind == "Status") {
|
||||
break;
|
||||
case "Status"_cnc:
|
||||
_typeDatabase[ScriptCategory::Status].Insert(effectName,
|
||||
new AngelScriptTypeInfo(effectName, typeInfo));
|
||||
} else if (metadataKind == "Battle") {
|
||||
break;
|
||||
case "Battle"_cnc:
|
||||
_typeDatabase[ScriptCategory::Battle].Insert(effectName,
|
||||
new AngelScriptTypeInfo(effectName, typeInfo));
|
||||
} else if (metadataKind == "Side") {
|
||||
break;
|
||||
case "Side"_cnc:
|
||||
_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));
|
||||
break;
|
||||
case "Weather"_cnc:
|
||||
_typeDatabase[static_cast<ScriptCategory>(PkmnScriptCategory::Weather)].Insert(
|
||||
effectName, new AngelScriptTypeInfo(effectName, typeInfo));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -236,8 +243,8 @@ void AngelScripResolver::LoadByteCodeFromMemory(
|
|||
InitializeByteCode(stream, types);
|
||||
delete stream;
|
||||
}
|
||||
void AngelScripResolver::InitializeByteCode(asIBinaryStream* stream,
|
||||
const Dictionary<ScriptCategory, Dictionary<ConstString, const char*>>& types) {
|
||||
void AngelScripResolver::InitializeByteCode(
|
||||
asIBinaryStream* stream, const Dictionary<ScriptCategory, Dictionary<ConstString, const char*>>& types) {
|
||||
int result = _mainModule->LoadByteCode(stream);
|
||||
Assert(result == asSUCCESS);
|
||||
|
||||
|
|
Loading…
Reference in New Issue