diff options
Diffstat (limited to 'NorthstarDedicatedTest/squirrel.cpp')
-rw-r--r-- | NorthstarDedicatedTest/squirrel.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/squirrel.cpp b/NorthstarDedicatedTest/squirrel.cpp index b1c5b4a8..d0d54a3a 100644 --- a/NorthstarDedicatedTest/squirrel.cpp +++ b/NorthstarDedicatedTest/squirrel.cpp @@ -72,6 +72,9 @@ sq_pushboolType ServerSq_pushbool; sq_pusherrorType ClientSq_pusherror; sq_pusherrorType ServerSq_pusherror; +sq_pushAssetType ClientSq_pushAsset; +sq_pushAssetType ServerSq_pushAsset; + // sq stack get funcs sq_getstringType ClientSq_getstring; sq_getstringType ServerSq_getstring; @@ -136,6 +139,7 @@ void InitialiseClientSquirrel(HMODULE baseAddress) ClientSq_pushfloat = (sq_pushfloatType)((char*)baseAddress + 0x3800); ClientSq_pushbool = (sq_pushboolType)((char*)baseAddress + 0x3710); ClientSq_pusherror = (sq_pusherrorType)((char*)baseAddress + 0x8470); + ClientSq_pushAsset = (sq_pushAssetType)((char*)baseAddress + 0x3560); ClientSq_getstring = (sq_getstringType)((char*)baseAddress + 0x60C0); ClientSq_getinteger = (sq_getintegerType)((char*)baseAddress + 0x60E0); @@ -190,6 +194,7 @@ void InitialiseServerSquirrel(HMODULE baseAddress) ServerSq_pushfloat = (sq_pushfloatType)((char*)baseAddress + 0x3800); ServerSq_pushbool = (sq_pushboolType)((char*)baseAddress + 0x3710); ServerSq_pusherror = (sq_pusherrorType)((char*)baseAddress + 0x8440); + ServerSq_pushAsset = (sq_pushAssetType)((char*)baseAddress + 0x3560); ServerSq_getstring = (sq_getstringType)((char*)baseAddress + 0x60A0); ServerSq_getinteger = (sq_getintegerType)((char*)baseAddress + 0x60C0); @@ -485,4 +490,28 @@ template <ScriptContext context> int64_t RegisterSquirrelFuncHook(void* sqvm, SQ return ServerRegisterSquirrelFunc(sqvm, funcReg, unknown); else return ClientRegisterSquirrelFunc(sqvm, funcReg, unknown); +} + +SQReturnTypeEnum GetReturnTypeEnumFromString(const char* returnTypeString) +{ + + static std::map<std::string, SQReturnTypeEnum> sqEnumStrMap = { + {"bool", SqReturnBoolean}, + {"float", SqReturnFloat}, + {"vector", SqReturnVector}, + {"int", SqReturnInteger}, + {"entity", SqReturnEntity}, + {"string", SqReturnString}, + {"array", SqReturnArrays}, + {"asset", SqReturnAsset}, + {"table", SqReturnTable}}; + + if (sqEnumStrMap.count(returnTypeString)) + { + return sqEnumStrMap[returnTypeString]; + } + else + { + return SqReturnDefault; // previous default value + } }
\ No newline at end of file |