mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-16 00:03:45 +00:00
Fixed bug, where cguid was set whenever agent was connected, rather than only for agent db
This commit is contained in:
@@ -504,7 +504,7 @@ void ILibDuktape_Process_UncaughtException(duk_context *ctx)
|
||||
{
|
||||
if (ctx != NULL) { ILibDuktape_Process_UncaughtExceptionEx(ctx, ""); }
|
||||
}
|
||||
char* Duktape_GetContextGuidHex(duk_context *ctx)
|
||||
char* Duktape_GetContextGuidHex(duk_context *ctx, void *db)
|
||||
{
|
||||
char *retVal = NULL;
|
||||
|
||||
@@ -512,7 +512,7 @@ char* Duktape_GetContextGuidHex(duk_context *ctx)
|
||||
if (duk_has_prop_string(ctx, -1, "\xFF_ScriptContainerSettings_DB"))
|
||||
{
|
||||
duk_get_prop_string(ctx, -1, "\xFF_ScriptContainerSettings_DB"); // [stash][db]
|
||||
if (duk_get_pointer(ctx, -1) != NULL) { retVal = "0"; }
|
||||
if (duk_get_pointer(ctx, -1) != NULL && duk_get_pointer(ctx, -1) == db) { retVal = "0"; }
|
||||
duk_pop(ctx); // [stash]
|
||||
}
|
||||
duk_pop(ctx); // ...
|
||||
|
||||
@@ -47,7 +47,7 @@ typedef enum ILibDuktape_LogTypes
|
||||
}ILibDuktape_LogTypes;
|
||||
|
||||
void ILibDuktape_Log_Object(duk_context *ctx, duk_idx_t i, char *meta);
|
||||
char* Duktape_GetContextGuidHex(duk_context *ctx);
|
||||
char* Duktape_GetContextGuidHex(duk_context *ctx, void *db);
|
||||
void *Duktape_GetChain(duk_context *ctx);
|
||||
char *Duktape_GetStashKey(void* value);
|
||||
char* Duktape_GetBuffer(duk_context *ctx, duk_idx_t i, duk_size_t *bufLen);
|
||||
|
||||
@@ -41,7 +41,7 @@ duk_ret_t ILibDuktape_SimpleDataStore_Finalizer(duk_context *ctx)
|
||||
}
|
||||
duk_ret_t ILibDuktape_SimpleDataStore_Put(duk_context *ctx)
|
||||
{
|
||||
char *cguid = Duktape_GetContextGuidHex(ctx);
|
||||
char *cguid = NULL;
|
||||
duk_size_t keyLen;
|
||||
char *key;
|
||||
char *value;
|
||||
@@ -64,6 +64,7 @@ duk_ret_t ILibDuktape_SimpleDataStore_Put(duk_context *ctx)
|
||||
duk_push_this(ctx); // [ds]
|
||||
duk_get_prop_string(ctx, -1, ILibDuktape_DataStore_PTR); // [ds][ptr]
|
||||
dataStore = (ILibSimpleDataStore)duk_to_pointer(ctx, -1);
|
||||
cguid = Duktape_GetContextGuidHex(ctx, dataStore);
|
||||
|
||||
if (cguid != NULL)
|
||||
{
|
||||
@@ -76,7 +77,7 @@ duk_ret_t ILibDuktape_SimpleDataStore_Put(duk_context *ctx)
|
||||
}
|
||||
duk_ret_t ILibDuktape_SimpleDataStore_GetRaw(duk_context *ctx)
|
||||
{
|
||||
char *cguid = Duktape_GetContextGuidHex(ctx);
|
||||
char *cguid = NULL;
|
||||
char *key = (char*)duk_require_string(ctx, 0);
|
||||
ILibSimpleDataStore dataStore;
|
||||
char *buffer;
|
||||
@@ -87,6 +88,7 @@ duk_ret_t ILibDuktape_SimpleDataStore_GetRaw(duk_context *ctx)
|
||||
duk_get_prop_string(ctx, -1, ILibDuktape_DataStore_PTR); // [ds][ptr]
|
||||
dataStore = (ILibSimpleDataStore)duk_to_pointer(ctx, -1);
|
||||
|
||||
cguid = Duktape_GetContextGuidHex(ctx, dataStore);
|
||||
if (cguid != NULL)
|
||||
{
|
||||
sprintf_s(ILibScratchPad2, sizeof(ILibScratchPad2), "%s/%s", cguid, key);
|
||||
@@ -163,7 +165,7 @@ duk_ret_t ILibDuktape_SimpleDataStore_Keys(duk_context *ctx)
|
||||
|
||||
enumerator.ctx = ctx;
|
||||
enumerator.count = 0;
|
||||
enumerator.GuidHex = Duktape_GetContextGuidHex(ctx);
|
||||
enumerator.GuidHex = Duktape_GetContextGuidHex(ctx, ds);
|
||||
if (enumerator.GuidHex != NULL)
|
||||
{
|
||||
enumerator.GuidHexLen = 1 + (int)strnlen_s(enumerator.GuidHex, sizeof(ILibScratchPad));
|
||||
|
||||
Reference in New Issue
Block a user