diff options
author | Emma Miler <emma.pi@protonmail.com> | 2022-12-22 19:59:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-22 19:59:10 +0100 |
commit | 64100065b55f79e76542ba689545c60e6fb0dcef (patch) | |
tree | 396bfeb9eacdd6d8070dee89de16c6c216ac6b10 /NorthstarDLL/squirrel | |
parent | 7cdf27e6dfcf61329317e641e6625599cda3f5b0 (diff) | |
download | NorthstarLauncher-64100065b55f79e76542ba689545c60e6fb0dcef.tar.gz NorthstarLauncher-64100065b55f79e76542ba689545c60e6fb0dcef.zip |
Add script concommands (#373)
* Add script concommands
* Fix indent
* Formatting
* Formatting stuff
* Changes for review
* Fix typo
* Forgot to remove the return statement
* Formatting
Diffstat (limited to 'NorthstarDLL/squirrel')
-rw-r--r-- | NorthstarDLL/squirrel/squirrel.cpp | 12 | ||||
-rw-r--r-- | NorthstarDLL/squirrel/squirrel.h | 2 | ||||
-rw-r--r-- | NorthstarDLL/squirrel/squirrelclasstypes.h | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp index 5e968daa..8761fb13 100644 --- a/NorthstarDLL/squirrel/squirrel.cpp +++ b/NorthstarDLL/squirrel/squirrel.cpp @@ -88,6 +88,18 @@ eSQReturnType SQReturnTypeFromString(const char* pReturnType) return eSQReturnType::Default; // previous default value } +ScriptContext ScriptContextFromString(std::string string) +{ + if (string == "UI") + return ScriptContext::UI; + if (string == "CLIENT") + return ScriptContext::CLIENT; + if (string == "SERVER") + return ScriptContext::SERVER; + else + return ScriptContext::INVALID; +} + const char* SQTypeNameFromID(int type) { switch (type) diff --git a/NorthstarDLL/squirrel/squirrel.h b/NorthstarDLL/squirrel/squirrel.h index 3e3d08c9..51fa93b3 100644 --- a/NorthstarDLL/squirrel/squirrel.h +++ b/NorthstarDLL/squirrel/squirrel.h @@ -37,6 +37,8 @@ const char* GetContextName_Short(ScriptContext context); eSQReturnType SQReturnTypeFromString(const char* pReturnType); const char* SQTypeNameFromID(const int iTypeId); +ScriptContext ScriptContextFromString(std::string string); + std::shared_ptr<ColoredLogger> getSquirrelLoggerByContext(ScriptContext context); namespace NS::log diff --git a/NorthstarDLL/squirrel/squirrelclasstypes.h b/NorthstarDLL/squirrel/squirrelclasstypes.h index e26bc8d0..0672724c 100644 --- a/NorthstarDLL/squirrel/squirrelclasstypes.h +++ b/NorthstarDLL/squirrel/squirrelclasstypes.h @@ -73,6 +73,7 @@ struct SQFuncRegistration enum class ScriptContext : int { + INVALID = -1, SERVER, CLIENT, UI, |