summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-04-11 09:55:22 +0200
committerRémi Verschelde <remi@verschelde.fr>2016-04-11 09:55:22 +0200
commit57cddf3811b3abfe557aac4ebcf55394b51ee596 (patch)
tree8a73fb1d05d49897e8368f112c8ebdb96e8164cc
parentb6a2459870412d887b2fe3dd1011bf446b5bfe2b (diff)
parentd643a40f95b7f7392f143f68d970a0db8c61c491 (diff)
Merge pull request #4269 from SaracenOne/subclass_extend
Subclasses can now extend from other subclasses in relative scripts.
-rw-r--r--modules/gdscript/gd_compiler.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index e8e8ce4e96..d38f5f3e35 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -1421,7 +1421,22 @@ Error GDCompiler::_parse_class(GDScript *p_script,GDScript *p_owner,const GDPars
if (path.is_rel_path()) {
- String base = p_script->get_path();
+ String base;
+
+ if (p_owner) {
+ GDScript *current_class = p_owner;
+ while (current_class != NULL) {
+ base=current_class->get_path();
+ if (base=="")
+ current_class = current_class->_owner;
+ else
+ break;
+ }
+ }
+ else {
+ base = p_script->get_path();
+ }
+
if (base=="" || base.is_rel_path()) {
_set_error("Could not resolve relative path for parent class: "+path,p_class);
return ERR_FILE_NOT_FOUND;