aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/squirrel.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-09-04 22:47:02 +0200
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-09-09 00:43:59 +0200
commitb80d330ac865aa97177825d09c7b1edc09114d11 (patch)
tree7402fd0f1603b6b74d6341a0abd2150d622435e8 /NorthstarDLL/squirrel.cpp
parent4d6452865eb3e2b2abec3f5afe9de66ca7f1855b (diff)
downloadNorthstarLauncher-b80d330ac865aa97177825d09c7b1edc09114d11.tar.gz
NorthstarLauncher-b80d330ac865aa97177825d09c7b1edc09114d11.zip
Get rid of context filerefactor-remove-context-file
This is basically 77a1195d77034c00959dfd030e2eb7a57d58a88d from refactor PR redone on top of main
Diffstat (limited to 'NorthstarDLL/squirrel.cpp')
-rw-r--r--NorthstarDLL/squirrel.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/NorthstarDLL/squirrel.cpp b/NorthstarDLL/squirrel.cpp
index 2fa957fb..b52d266f 100644
--- a/NorthstarDLL/squirrel.cpp
+++ b/NorthstarDLL/squirrel.cpp
@@ -107,6 +107,32 @@ SquirrelManager<ScriptContext::CLIENT>* g_ClientSquirrelManager;
SquirrelManager<ScriptContext::SERVER>* g_ServerSquirrelManager;
SquirrelManager<ScriptContext::UI>* g_UISquirrelManager;
+template <ScriptContext context> SquirrelManager<context>* GetSquirrelManager()
+{
+ switch (context)
+ {
+ case ScriptContext::CLIENT:
+ return g_ClientSquirrelManager;
+ case ScriptContext::SERVER:
+ return g_ServerSquirrelManager;
+ case ScriptContext::UI:
+ return g_UISquirrelManager;
+ }
+}
+
+const char* GetContextName(ScriptContext context)
+{
+ switch (context)
+ {
+ case ScriptContext::CLIENT:
+ return "CLIENT";
+ case ScriptContext::SERVER:
+ return "SERVER";
+ case ScriptContext::UI:
+ return "UI";
+ }
+}
+
SQInteger NSTestFunc(void* sqvm)
{
return 1;