aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/squirrel
diff options
context:
space:
mode:
authorGeckoEidechse <gecko.eidechse+git@pm.me>2023-09-17 01:45:16 +0200
committerGeckoEidechse <gecko.eidechse+git@pm.me>2023-09-17 01:45:16 +0200
commit5cbe9f7317899cd815b38d9f083bc99738fc1dd3 (patch)
tree9afdce5ae5e76f68be85c25a84afcff86f31d3f8 /NorthstarDLL/squirrel
parentb7823492e802456d44e4919940267081bf436f08 (diff)
downloadNorthstarLauncher-5cbe9f7317899cd815b38d9f083bc99738fc1dd3.tar.gz
NorthstarLauncher-5cbe9f7317899cd815b38d9f083bc99738fc1dd3.zip
test ci format checkindentation-test
Diffstat (limited to 'NorthstarDLL/squirrel')
-rw-r--r--NorthstarDLL/squirrel/squirrel.cpp72
-rw-r--r--NorthstarDLL/squirrel/squirrel.h16
-rw-r--r--NorthstarDLL/squirrel/squirrelautobind.h58
-rw-r--r--NorthstarDLL/squirrel/squirrelclasstypes.h8
4 files changed, 77 insertions, 77 deletions
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<std::string, eSQReturnType> 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 <ScriptContext context> void SquirrelManager<context>::ExecuteCode(cons
}
template <ScriptContext context> void SquirrelManager<context>::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 <ScriptContext context> void SquirrelManager<context>::ProcessMessageBu
if (result != 0) // This func returns 0 on success for some reason
{
NS::log::squirrel_logger<context>()->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 <ScriptContext context> void SquirrelManager<context>::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<context>->getinteger(sqvm, 1);
if (auto mod = g_pSquirrel<context>->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<context>->getinteger(sqvm, 1);
if (auto mod = g_pSquirrel<context>->getcallingmod(sqvm, depth); mod == nullptr)
@@ -772,7 +772,7 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module))
g_pSquirrel<ScriptContext::CLIENT>->__sq_GetEntityConstant_CBaseEntity = module.Offset(0x3E49B0).RCast<sq_GetEntityConstantType>();
g_pSquirrel<ScriptContext::CLIENT>->__sq_getentityfrominstance = module.Offset(0x114F0).RCast<sq_getentityfrominstanceType>();
g_pSquirrel<ScriptContext::UI>->__sq_GetEntityConstant_CBaseEntity =
- g_pSquirrel<ScriptContext::CLIENT>->__sq_GetEntityConstant_CBaseEntity;
+ g_pSquirrel<ScriptContext::CLIENT>->__sq_GetEntityConstant_CBaseEntity;
g_pSquirrel<ScriptContext::UI>->__sq_getentityfrominstance = g_pSquirrel<ScriptContext::CLIENT>->__sq_getentityfrominstance;
// Message buffer stuff
@@ -789,9 +789,9 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module))
g_pSquirrel<ScriptContext::UI>->__sq_sealstructslot = g_pSquirrel<ScriptContext::CLIENT>->__sq_sealstructslot;
MAKEHOOK(
- module.Offset(0x108E0),
- &RegisterSquirrelFunctionHook<ScriptContext::CLIENT>,
- &g_pSquirrel<ScriptContext::CLIENT>->RegisterSquirrelFunc);
+ module.Offset(0x108E0),
+ &RegisterSquirrelFunctionHook<ScriptContext::CLIENT>,
+ &g_pSquirrel<ScriptContext::CLIENT>->RegisterSquirrelFunc);
g_pSquirrel<ScriptContext::UI>->RegisterSquirrelFunc = g_pSquirrel<ScriptContext::CLIENT>->RegisterSquirrelFunc;
g_pSquirrel<ScriptContext::CLIENT>->logger = NS::log::SCRIPT_CL;
@@ -882,9 +882,9 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (CModule module))
g_pSquirrel<ScriptContext::SERVER>->__sq_sealstructslot = module.Offset(0x5510).RCast<sq_sealstructslotType>();
MAKEHOOK(
- module.Offset(0x1DD10),
- &RegisterSquirrelFunctionHook<ScriptContext::SERVER>,
- &g_pSquirrel<ScriptContext::SERVER>->RegisterSquirrelFunc);
+ module.Offset(0x1DD10),
+ &RegisterSquirrelFunctionHook<ScriptContext::SERVER>,
+ &g_pSquirrel<ScriptContext::SERVER>->RegisterSquirrelFunc);
MAKEHOOK(module.Offset(0x8AA0), &sq_compiler_createHook<ScriptContext::SERVER>, &sq_compiler_create<ScriptContext::SERVER>);
@@ -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<ScriptContext::SERVER>,
- "Executes script code on the server vm",
- FCVAR_GAMEDLL | FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS | FCVAR_CHEAT);
+ "script",
+ ConCommand_script<ScriptContext::SERVER>,
+ "Executes script code on the server vm",
+ FCVAR_GAMEDLL | FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS | FCVAR_CHEAT);
StubUnsafeSQFuncs<ScriptContext::SERVER>();
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 <ScriptContext context, typename T> inline void SqRecurseArgs(FunctionVector& v, T& arg);
@@ -16,7 +16,7 @@ template <ScriptContext context, typename T> inline void SqRecurseArgs(FunctionV
template <ScriptContext context, typename T, typename... Args> inline void SqRecurseArgs(FunctionVector& v, T& arg, Args... args);
/*
- sanity below
+ sanity below
*/
// stolen from ttf2sdk: sqvm types
@@ -354,7 +354,7 @@ template <ScriptContext context> 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 <ScriptContext context> 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 <ScriptContext context> SquirrelManager<context>* 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<ScriptContext::UI>->AddFuncRegistration( \
- returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::UI >); \
- if constexpr (runOnContext & ScriptContext::CLIENT) \
- g_pSquirrel<ScriptContext::CLIENT>->AddFuncRegistration( \
- returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::CLIENT >); \
- }, \
- []() \
- { \
- if constexpr (runOnContext & ScriptContext::SERVER) \
- g_pSquirrel<ScriptContext::SERVER>->AddFuncRegistration( \
- returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::SERVER >); \
- }); \
+ []() \
+ { \
+ if constexpr (runOnContext & ScriptContext::UI) \
+ g_pSquirrel<ScriptContext::UI>->AddFuncRegistration( \
+ returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::UI >); \
+ if constexpr (runOnContext & ScriptContext::CLIENT) \
+ g_pSquirrel<ScriptContext::CLIENT>->AddFuncRegistration( \
+ returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::CLIENT >); \
+ }, \
+ []() \
+ { \
+ if constexpr (runOnContext & ScriptContext::SERVER) \
+ g_pSquirrel<ScriptContext::SERVER>->AddFuncRegistration( \
+ returnType, __STR(funcName), argTypes, helpText, CONCAT2(Script_, funcName) < ScriptContext::SERVER >); \
+ }); \
} \
template <ScriptContext context> SQRESULT CONCAT2(Script_, funcName)(HSquirrelVM * sqvm)
@@ -42,20 +42,20 @@ class __squirrelautobind;
namespace \
{ \
__squirrelautobind CONCAT2(__squirrelautobind, __LINE__)( \
- []() \
- { \
- if constexpr (runOnContext & ScriptContext::UI) \
- g_pSquirrel<ScriptContext::UI>->AddFuncOverride(__STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::UI >); \
- if constexpr (runOnContext & ScriptContext::CLIENT) \
- g_pSquirrel<ScriptContext::CLIENT>->AddFuncOverride( \
- __STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::CLIENT >); \
- }, \
- []() \
- { \
- if constexpr (runOnContext & ScriptContext::SERVER) \
- g_pSquirrel<ScriptContext::SERVER>->AddFuncOverride( \
- __STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::SERVER >); \
- }); \
+ []() \
+ { \
+ if constexpr (runOnContext & ScriptContext::UI) \
+ g_pSquirrel<ScriptContext::UI>->AddFuncOverride(__STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::UI >); \
+ if constexpr (runOnContext & ScriptContext::CLIENT) \
+ g_pSquirrel<ScriptContext::CLIENT>->AddFuncOverride( \
+ __STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::CLIENT >); \
+ }, \
+ []() \
+ { \
+ if constexpr (runOnContext & ScriptContext::SERVER) \
+ g_pSquirrel<ScriptContext::SERVER>->AddFuncOverride( \
+ __STR(funcName), CONCAT2(Script_, funcName) < ScriptContext::SERVER >); \
+ }); \
} \
template <ScriptContext context> 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<SQRESULT, const char*> 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);