summaryrefslogtreecommitdiff
path: root/modules/gdscript/gd_script.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-05-02 12:40:34 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-05-02 12:40:34 -0300
commitf1d3b30a45f31c217929ec86b010736feed1714c (patch)
treefa3c6b5e88ae5d554e6b04d07bfcb6a5e715f0e5 /modules/gdscript/gd_script.cpp
parent6572d5128856b2ec55a2c417c92e584899f4906f (diff)
Fixes to constants in scope
Diffstat (limited to 'modules/gdscript/gd_script.cpp')
-rw-r--r--modules/gdscript/gd_script.cpp17
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;
}