Skip to content

Commit

Permalink
Fix property results in convResearch() (#3798)
Browse files Browse the repository at this point in the history
  • Loading branch information
1269339743 committed May 13, 2024
1 parent ab9f711 commit bdf4a4c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/quickjs_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
}

Expand Down

0 comments on commit bdf4a4c

Please sign in to comment.