From 5cbe9f7317899cd815b38d9f083bc99738fc1dd3 Mon Sep 17 00:00:00 2001 From: GeckoEidechse Date: Sun, 17 Sep 2023 01:45:16 +0200 Subject: test ci format check --- NorthstarDLL/squirrel/squirrel.cpp | 72 +++++++++++++++--------------- NorthstarDLL/squirrel/squirrel.h | 16 +++---- NorthstarDLL/squirrel/squirrelautobind.h | 58 ++++++++++++------------ NorthstarDLL/squirrel/squirrelclasstypes.h | 8 ++-- 4 files changed, 77 insertions(+), 77 deletions(-) (limited to 'NorthstarDLL/squirrel') diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp index 0ee04508..cc1b53a4 100644 --- a/NorthstarDLL/squirrel/squirrel.cpp +++ b/NorthstarDLL/squirrel/squirrel.cpp @@ -75,15 +75,15 @@ const char* GetContextName_Short(ScriptContext context) eSQReturnType SQReturnTypeFromString(const char* pReturnType) { static const std::map sqReturnTypeNameToString = { - {"bool", eSQReturnType::Boolean}, - {"float", eSQReturnType::Float}, - {"vector", eSQReturnType::Vector}, - {"int", eSQReturnType::Integer}, - {"entity", eSQReturnType::Entity}, - {"string", eSQReturnType::String}, - {"array", eSQReturnType::Arrays}, - {"asset", eSQReturnType::Asset}, - {"table", eSQReturnType::Table}}; + {"bool", eSQReturnType::Boolean}, + {"float", eSQReturnType::Float}, + {"vector", eSQReturnType::Vector}, + {"int", eSQReturnType::Integer}, + {"entity", eSQReturnType::Entity}, + {"string", eSQReturnType::String}, + {"array", eSQReturnType::Arrays}, + {"asset", eSQReturnType::Asset}, + {"table", eSQReturnType::Table}}; if (sqReturnTypeNameToString.find(pReturnType) != sqReturnTypeNameToString.end()) return sqReturnTypeNameToString.at(pReturnType); @@ -320,7 +320,7 @@ template void SquirrelManager::ExecuteCode(cons } template void SquirrelManager::AddFuncRegistration( - std::string returnType, std::string name, std::string argTypes, std::string helpText, SQFunction func) + std::string returnType, std::string name, std::string argTypes, std::string helpText, SQFunction func) { SQFuncRegistration* reg = new SQFuncRegistration; @@ -480,10 +480,10 @@ void __fastcall ScriptCompileErrorHook(HSquirrelVM* sqvm, const char* error, con else { R2::Cbuf_AddText( - R2::Cbuf_GetCurrentPlayer(), - fmt::format("disconnect \"Encountered {} script compilation error, see console for details.\"", GetContextName(realContext)) - .c_str(), - R2::cmd_source_t::kCommandSrcCode); + R2::Cbuf_GetCurrentPlayer(), + fmt::format("disconnect \"Encountered {} script compilation error, see console for details.\"", GetContextName(realContext)) + .c_str(), + R2::cmd_source_t::kCommandSrcCode); // likely temp: show console so user can see any errors, as error message wont display if ui is dead // maybe we could disable all mods other than the coremods and try a reload before doing this? @@ -636,7 +636,7 @@ template void SquirrelManager::ProcessMessageBu if (result != 0) // This func returns 0 on success for some reason { NS::log::squirrel_logger()->error( - "ProcessMessageBuffer was unable to find function with name '{}'. Is it global?", message.functionName); + "ProcessMessageBuffer was unable to find function with name '{}'. Is it global?", message.functionName); continue; } @@ -661,11 +661,11 @@ template void SquirrelManager::ProcessMessageBu } ADD_SQFUNC( - "string", - NSGetCurrentModName, - "", - "Returns the mod name of the script running this function", - ScriptContext::UI | ScriptContext::CLIENT | ScriptContext::SERVER) + "string", + NSGetCurrentModName, + "", + "Returns the mod name of the script running this function", + ScriptContext::UI | ScriptContext::CLIENT | ScriptContext::SERVER) { int depth = g_pSquirrel->getinteger(sqvm, 1); if (auto mod = g_pSquirrel->getcallingmod(sqvm, depth); mod == nullptr) @@ -681,11 +681,11 @@ ADD_SQFUNC( } ADD_SQFUNC( - "string", - NSGetCallingModName, - "int depth = 0", - "Returns the mod name of the script running this function", - ScriptContext::UI | ScriptContext::CLIENT | ScriptContext::SERVER) + "string", + NSGetCallingModName, + "int depth = 0", + "Returns the mod name of the script running this function", + ScriptContext::UI | ScriptContext::CLIENT | ScriptContext::SERVER) { int depth = g_pSquirrel->getinteger(sqvm, 1); if (auto mod = g_pSquirrel->getcallingmod(sqvm, depth); mod == nullptr) @@ -772,7 +772,7 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module)) g_pSquirrel->__sq_GetEntityConstant_CBaseEntity = module.Offset(0x3E49B0).RCast(); g_pSquirrel->__sq_getentityfrominstance = module.Offset(0x114F0).RCast(); g_pSquirrel->__sq_GetEntityConstant_CBaseEntity = - g_pSquirrel->__sq_GetEntityConstant_CBaseEntity; + g_pSquirrel->__sq_GetEntityConstant_CBaseEntity; g_pSquirrel->__sq_getentityfrominstance = g_pSquirrel->__sq_getentityfrominstance; // Message buffer stuff @@ -789,9 +789,9 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module)) g_pSquirrel->__sq_sealstructslot = g_pSquirrel->__sq_sealstructslot; MAKEHOOK( - module.Offset(0x108E0), - &RegisterSquirrelFunctionHook, - &g_pSquirrel->RegisterSquirrelFunc); + module.Offset(0x108E0), + &RegisterSquirrelFunctionHook, + &g_pSquirrel->RegisterSquirrelFunc); g_pSquirrel->RegisterSquirrelFunc = g_pSquirrel->RegisterSquirrelFunc; g_pSquirrel->logger = NS::log::SCRIPT_CL; @@ -882,9 +882,9 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (CModule module)) g_pSquirrel->__sq_sealstructslot = module.Offset(0x5510).RCast(); MAKEHOOK( - module.Offset(0x1DD10), - &RegisterSquirrelFunctionHook, - &g_pSquirrel->RegisterSquirrelFunc); + module.Offset(0x1DD10), + &RegisterSquirrelFunctionHook, + &g_pSquirrel->RegisterSquirrelFunc); MAKEHOOK(module.Offset(0x8AA0), &sq_compiler_createHook, &sq_compiler_create); @@ -897,10 +897,10 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (CModule module)) // FCVAR_CHEAT and FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS allows clients to execute this, but since it's unsafe we only allow it when cheats // are enabled for script_client and script_ui, we don't use cheats, so clients can execute them on themselves all they want RegisterConCommand( - "script", - ConCommand_script, - "Executes script code on the server vm", - FCVAR_GAMEDLL | FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS | FCVAR_CHEAT); + "script", + ConCommand_script, + "Executes script code on the server vm", + FCVAR_GAMEDLL | FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS | FCVAR_CHEAT); StubUnsafeSQFuncs(); diff --git a/NorthstarDLL/squirrel/squirrel.h b/NorthstarDLL/squirrel/squirrel.h index 427eb03c..743d84ed 100644 --- a/NorthstarDLL/squirrel/squirrel.h +++ b/NorthstarDLL/squirrel/squirrel.h @@ -7,8 +7,8 @@ #include "mods/modmanager.h" /* - definitions from hell - required to function + definitions from hell + required to function */ template inline void SqRecurseArgs(FunctionVector& v, T& arg); @@ -16,7 +16,7 @@ template inline void SqRecurseArgs(FunctionV template inline void SqRecurseArgs(FunctionVector& v, T& arg, Args... args); /* - sanity below + sanity below */ // stolen from ttf2sdk: sqvm types @@ -354,7 +354,7 @@ template class SquirrelManager : public virtual Squirrel if (!m_pSQVM || !m_pSQVM->sqvm) { spdlog::error( - "{} was called on context {} while VM was not initialized. This will crash", __FUNCTION__, GetContextName(context)); + "{} was called on context {} while VM was not initialized. This will crash", __FUNCTION__, GetContextName(context)); } SQObject functionobj {}; @@ -378,7 +378,7 @@ template class SquirrelManager : public virtual Squirrel if (!m_pSQVM || !m_pSQVM->sqvm) { spdlog::error( - "{} was called on context {} while VM was not initialized. This will crash", __FUNCTION__, GetContextName(context)); + "{} was called on context {} while VM was not initialized. This will crash", __FUNCTION__, GetContextName(context)); } SQObject functionobj {}; int result = sq_getfunction(m_pSQVM->sqvm, funcname, &functionobj, 0); @@ -425,9 +425,9 @@ template SquirrelManager* g_pSquirrel; void InitialiseSquirrelManagers(); /* - Beware all ye who enter below. - This place is not a place of honor... no highly esteemed deed is commemorated here... nothing valued is here. - What is here was dangerous and repulsive to us. This message is a warning about danger. + Beware all ye who enter below. + This place is not a place of honor... no highly esteemed deed is commemorated here... nothing valued is here. + What is here was dangerous and repulsive to us. This message is a warning about danger. */ #pragma region MessageBuffer templates diff --git a/NorthstarDLL/squirrel/squirrelautobind.h b/NorthstarDLL/squirrel/squirrelautobind.h index 865479a1..4d5e8649 100644 --- a/NorthstarDLL/squirrel/squirrelautobind.h +++ b/NorthstarDLL/squirrel/squirrelautobind.h @@ -19,21 +19,21 @@ class __squirrelautobind; namespace \ { \ __squirrelautobind CONCAT2(__squirrelautobind, __LINE__)( \ - []() \ - { \ - if constexpr (runOnContext & ScriptContext::UI) \ - g_pSquirrel->AddFuncRegistration( \ - returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::UI >); \ - if constexpr (runOnContext & ScriptContext::CLIENT) \ - g_pSquirrel->AddFuncRegistration( \ - returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::CLIENT >); \ - }, \ - []() \ - { \ - if constexpr (runOnContext & ScriptContext::SERVER) \ - g_pSquirrel->AddFuncRegistration( \ - returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::SERVER >); \ - }); \ + []() \ + { \ + if constexpr (runOnContext & ScriptContext::UI) \ + g_pSquirrel->AddFuncRegistration( \ + returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::UI >); \ + if constexpr (runOnContext & ScriptContext::CLIENT) \ + g_pSquirrel->AddFuncRegistration( \ + returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::CLIENT >); \ + }, \ + []() \ + { \ + if constexpr (runOnContext & ScriptContext::SERVER) \ + g_pSquirrel->AddFuncRegistration( \ + returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::SERVER >); \ + }); \ } \ template SQRESULT CONCAT2(Script_, funcName)(HSquirrelVM * sqvm) @@ -42,20 +42,20 @@ class __squirrelautobind; namespace \ { \ __squirrelautobind CONCAT2(__squirrelautobind, __LINE__)( \ - []() \ - { \ - if constexpr (runOnContext & ScriptContext::UI) \ - g_pSquirrel->AddFuncOverride(__STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::UI >); \ - if constexpr (runOnContext & ScriptContext::CLIENT) \ - g_pSquirrel->AddFuncOverride( \ - __STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::CLIENT >); \ - }, \ - []() \ - { \ - if constexpr (runOnContext & ScriptContext::SERVER) \ - g_pSquirrel->AddFuncOverride( \ - __STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::SERVER >); \ - }); \ + []() \ + { \ + if constexpr (runOnContext & ScriptContext::UI) \ + g_pSquirrel->AddFuncOverride(__STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::UI >); \ + if constexpr (runOnContext & ScriptContext::CLIENT) \ + g_pSquirrel->AddFuncOverride( \ + __STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::CLIENT >); \ + }, \ + []() \ + { \ + if constexpr (runOnContext & ScriptContext::SERVER) \ + g_pSquirrel->AddFuncOverride( \ + __STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::SERVER >); \ + }); \ } \ template SQRESULT CONCAT2(Script_, funcName)(HSquirrelVM * sqvm) diff --git a/NorthstarDLL/squirrel/squirrelclasstypes.h b/NorthstarDLL/squirrel/squirrelclasstypes.h index ac813334..f0d338fe 100644 --- a/NorthstarDLL/squirrel/squirrelclasstypes.h +++ b/NorthstarDLL/squirrel/squirrelclasstypes.h @@ -27,9 +27,9 @@ enum class eSQReturnType }; const std::map PrintSQRESULT = { - {SQRESULT::SQRESULT_ERROR, "SQRESULT_ERROR"}, - {SQRESULT::SQRESULT_NULL, "SQRESULT_NULL"}, - {SQRESULT::SQRESULT_NOTNULL, "SQRESULT_NOTNULL"}}; + {SQRESULT::SQRESULT_ERROR, "SQRESULT_ERROR"}, + {SQRESULT::SQRESULT_NULL, "SQRESULT_NULL"}, + {SQRESULT::SQRESULT_NOTNULL, "SQRESULT_NOTNULL"}}; struct CompileBufferState { @@ -189,7 +189,7 @@ typedef int64_t (*RegisterSquirrelFuncType)(CSquirrelVM* sqvm, SQFuncRegistratio typedef void (*sq_defconstType)(CSquirrelVM* sqvm, const SQChar* name, int value); typedef SQRESULT (*sq_compilebufferType)( - HSquirrelVM* sqvm, CompileBufferState* compileBuffer, const char* file, int a1, SQBool bShouldThrowError); + HSquirrelVM* sqvm, CompileBufferState* compileBuffer, const char* file, int a1, SQBool bShouldThrowError); typedef SQRESULT (*sq_callType)(HSquirrelVM* sqvm, SQInteger iArgs, SQBool bShouldReturn, SQBool bThrowError); typedef SQInteger (*sq_raiseerrorType)(HSquirrelVM* sqvm, const SQChar* pError); typedef bool (*sq_compilefileType)(CSquirrelVM* sqvm, const char* path, const char* name, int a4); -- cgit v1.2.3