Check for script existence before version check

This commit is contained in:
Eddoursul 2024-02-14 11:22:01 +01:00
parent 23c16a0acf
commit e0a64bf551

View File

@ -85,8 +85,9 @@ inline void CheckScriptVersions()
scriptName(a_scriptName),
expectedVersion(a_version)
{
if (PapyrusGlobalFunctionExists(scriptName.c_str(), funcName.c_str())) {
const auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton();
const auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton();
if (vm->TypeIsValid(scriptName) && PapyrusGlobalFunctionExists(scriptName.c_str(), funcName.c_str())) {
auto callbackPtr = RE::BSTSmartPointer<RE::BSScript::IStackCallbackFunctor>(this);
vm->DispatchStaticCall(scriptName, funcName, RE::MakeFunctionArguments(), callbackPtr);
} else {
@ -124,7 +125,7 @@ inline void CheckScriptVersions()
new ScriptVersionCallback("_00E_PlayerhousingMaster", 1)
};
RE::BSTSmartPointer<ScriptVersionCallback>{
new ScriptVersionCallback("_00E_ContainerController", 1)
new ScriptVersionCallback("_00E_ContainerBonusControl", 1)
};
}