From 66193d728365098783e56a292541f01e9a4c57ca Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Sun, 1 Dec 2013 12:34:26 +0100 Subject: [PATCH] cppbind: Fix detecting derived Ghosts --- simgear/nasal/cppbind/Ghost.hxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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(); -- 2.39.5