From: Thomas Geymayer Date: Sun, 1 Dec 2013 11:34:26 +0000 (+0100) Subject: cppbind: Fix detecting derived Ghosts X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=66193d728365098783e56a292541f01e9a4c57ca;p=simgear.git cppbind: Fix detecting derived Ghosts --- diff --git a/simgear/nasal/cppbind/Ghost.hxx b/simgear/nasal/cppbind/Ghost.hxx index 75391e79..30524df3 100644 --- a/simgear/nasal/cppbind/Ghost.hxx +++ b/simgear/nasal/cppbind/Ghost.hxx @@ -67,6 +67,9 @@ namespace nasal bool isBaseOf(naGhostType* ghost_type) const { + if( ghost_type == _ghost_type_ptr ) + return true; + for( DerivedList::const_iterator derived = _derived_classes.begin(); derived != _derived_classes.end(); ++derived ) @@ -83,11 +86,14 @@ namespace nasal typedef std::vector DerivedList; const std::string _name; + const naGhostType *_ghost_type_ptr; DerivedList _derived_classes; std::vector _parents; - explicit GhostMetadata(const std::string& name): - _name(name) + GhostMetadata( const std::string& name, + const naGhostType* ghost_type ): + _name(name), + _ghost_type_ptr(ghost_type) { } @@ -545,8 +551,6 @@ namespace nasal { if( !ghost_type ) return false; - if( ghost_type == &_ghost_type ) - return true; return getSingletonPtr()->GhostMetadata::isBaseOf(ghost_type); } @@ -806,7 +810,7 @@ namespace nasal MemberMap _members; explicit Ghost(const std::string& name): - GhostMetadata( name ) + GhostMetadata(name, &_ghost_type) { _ghost_type.destroy = &destroyGhost; _ghost_type.name = _name.c_str();