From bdf4a4c5a3143a213049a2c72966075350009f90 Mon Sep 17 00:00:00 2001 From: 1269339743 <168625415+1269339743@users.noreply.github.com> Date: Tue, 14 May 2024 03:54:19 +0800 Subject: [PATCH] Fix property `results` in convResearch() (#3798) --- src/quickjs_backend.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/quickjs_backend.cpp b/src/quickjs_backend.cpp index 5b40ab03688..4f08002cf3d 100644 --- a/src/quickjs_backend.cpp +++ b/src/quickjs_backend.cpp @@ -756,6 +756,7 @@ static int QuickJS_DefinePropertyValue(JSContext *ctx, JSValueConst this_obj, co //;; * ```name``` A string containing the full name of the research. //;; * ```id``` A string containing the index name of the research. //;; * ```type``` The type will always be ```RESEARCH_DATA```. +//;; * ```results``` An array of objects of research upgrades (defined in "research.json"). //;; JSValue convResearch(const RESEARCH *psResearch, JSContext *ctx, int player) { @@ -781,7 +782,7 @@ JSValue convResearch(const RESEARCH *psResearch, JSContext *ctx, int player) QuickJS_DefinePropertyValue(ctx, value, "name", JS_NewString(ctx, psResearch->id.toUtf8().c_str()), JS_PROP_ENUMERABLE); // will be changed to contain fullname QuickJS_DefinePropertyValue(ctx, value, "id", JS_NewString(ctx, psResearch->id.toUtf8().c_str()), JS_PROP_ENUMERABLE); QuickJS_DefinePropertyValue(ctx, value, "type", JS_NewInt32(ctx, SCRIPT_RESEARCH), JS_PROP_ENUMERABLE); - QuickJS_DefinePropertyValue(ctx, value, "results", mapJsonToQuickJSValue(ctx, psResearch->results, 0), JS_PROP_ENUMERABLE); + QuickJS_DefinePropertyValue(ctx, value, "results", mapJsonToQuickJSValue(ctx, psResearch->results, JS_PROP_ENUMERABLE), JS_PROP_ENUMERABLE); return value; }