Hooks
static bool BeforeLuaSupport_CallTestAny(ICvEngineScriptSystem1* pkScriptSystem, const char* szName, ICvEngineScriptSystemArgs1* args, bool& value, bool& result);static void AfterLuaSupport_CallTestAny(ICvEngineScriptSystem1* pkScriptSystem, const char* szName, ICvEngineScriptSystemArgs1* args, bool& value, bool& result);static bool ReplaceLuaSupport_CallTestAny(bool (*original)(ICvEngineScriptSystem1*, const char*, ICvEngineScriptSystemArgs1*, bool&), ICvEngineScriptSystem1* pkScriptSystem, const char* szName, ICvEngineScriptSystemArgs1* args, bool& value);CivRegisterBefore<CivHooks::LuaSupport_CallTestAny>(host, &BeforeLuaSupport_CallTestAny);CivRegisterAfter<CivHooks::LuaSupport_CallTestAny>(host, &AfterLuaSupport_CallTestAny);CivRegisterReplace<CivHooks::LuaSupport_CallTestAny>(host, &ReplaceLuaSupport_CallTestAny);
Code
98bool LuaSupport::CallTestAny(ICvEngineScriptSystem1* pkScriptSystem, const char* szName, ICvEngineScriptSystemArgs1* args, bool& value)99{100 // Must release our lock so that if the main thread has the Lua lock and is waiting for the Game Core lock, we don't freeze101 bool bHadLock = gDLL->HasGameCoreLock();102 if(bHadLock)103 gDLL->ReleaseGameCoreLock();104 bool bResult = pkScriptSystem->CallTestAny(szName, args, value);105 if(bHadLock)106 gDLL->GetGameCoreLock();107 return bResult;108}