From 1d45c9a04c4c755843a162b872e59680fcb9c94d Mon Sep 17 00:00:00 2001 From: George Marques Date: Sun, 20 Sep 2015 16:17:30 -0300 Subject: [PATCH] Make dict2inst set internal members of instance Fix #2490 --- modules/gdscript/gd_functions.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index 37ddb2bc411..6f51ac53124 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -904,6 +904,15 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va r_ret = gdscr->_new(NULL,0,r_error); + GDInstance *ins = static_cast(static_cast(r_ret)->get_script_instance()); + Ref gd_ref = ins->get_script(); + + for(Map::Element *E = gd_ref->member_indices.front(); E; E = E->next()) { + if(d.has(E->key())) { + ins->members[E->get().index] = d[E->key()]; + } + } + } break; case HASH: {