Support for new version of CreatureLib.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2020-02-28 19:51:50 +01:00
parent dba8ae2b83
commit 29a82a5e75
19 changed files with 113 additions and 100 deletions

View File

@@ -85,18 +85,18 @@ void AngelScripResolver::RegisterTypes() {
BasicScriptClass::Register(_engine);
}
AngelScriptTypeInfo* AngelScripResolver::GetTypeInfo(const std::string& name, const std::string& decl) {
auto find = _types.find(decl);
AngelScriptTypeInfo* AngelScripResolver::GetTypeInfo(const ConstString& name, const std::string& decl) {
auto find = _types.find(name);
if (find != _types.end()) {
return find->second;
}
auto type = _mainModule->GetTypeInfoByDecl(decl.c_str());
if (type == nullptr) {
_types.insert({decl, nullptr});
_types.insert({name, nullptr});
return nullptr;
}
auto typeinfo = new AngelScriptTypeInfo(name, type);
_types.insert({decl, typeinfo});
_types.insert({name, typeinfo});
return typeinfo;
}
void AngelScripResolver::MessageCallback(const asSMessageInfo* msg, void* param) {
@@ -120,9 +120,9 @@ static constexpr const char* GetCategoryNamespace(ScriptCategory category) {
}
}
CreatureLib::Battling::Script* AngelScripResolver::LoadScript(ScriptCategory category, const std::string& scriptName) {
CreatureLib::Battling::Script* AngelScripResolver::LoadScript(ScriptCategory category, const ConstString& scriptName) {
std::stringstream decl;
decl << GetCategoryNamespace(category) << "::" << scriptName;
decl << GetCategoryNamespace(category) << "::" << scriptName.c_str();
auto typeInfo = GetTypeInfo(scriptName, decl.str());
if (typeInfo == nullptr)
return nullptr;