diff options
Diffstat (limited to 'modules/gdscript/gd_script.cpp')
-rw-r--r-- | modules/gdscript/gd_script.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 299a7d3e54..65b10399f8 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -76,16 +76,21 @@ Variant *GDFunction::_get_variant(int p_address,GDInstance *p_instance,GDScript case ADDR_TYPE_CLASS_CONSTANT: { //todo change to index! - GDScript *s=p_script; + GDScript *o=p_script; ERR_FAIL_INDEX_V(address,_global_names_count,NULL); const StringName *sn = &_global_names_ptr[address]; - while(s) { - Map<StringName,Variant>::Element *E=s->constants.find(*sn); - if (E) { - return &E->get(); + while(o) { + GDScript *s=o; + while(s) { + + Map<StringName,Variant>::Element *E=s->constants.find(*sn); + if (E) { + return &E->get(); + } + s=s->_base; } - s=s->_base; + o=o->_owner; } |