From 60eee7722d115ac1efae4a08527232b8edb8320a Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Fri, 17 Feb 2017 17:56:32 +0100 Subject: [PATCH] Another different fix for the pointer conversion issue. Based on the comments in the list I think it is better to keep the type that was originally provided as a reference, take the address of it, and store that in a ref_ptr. Possibly the problem was never compiler related rather OSG related; I'm using 3.5.x and it appears that there are better built in type conversions compared to the target version of 3.2 that we are currently using. --- src/Cockpit/od_gauge.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Cockpit/od_gauge.cxx b/src/Cockpit/od_gauge.cxx index a9e12f394..273e15ca7 100644 --- a/src/Cockpit/od_gauge.cxx +++ b/src/Cockpit/od_gauge.cxx @@ -71,14 +71,15 @@ FGODGauge::~FGODGauge() */ typedef struct { osg::ref_ptr parent; - osg::ref_ptr node; - int unit; + osg::ref_ptr node; + unsigned int unit; } GroupListItem; /** * Replace a texture in the airplane model with the gauge texture. */ class ReplaceStaticTextureVisitor: + public osg::NodeVisitor { public: @@ -174,7 +175,7 @@ class ReplaceStaticTextureVisitor: return; } - for( int unit = 0; unit < ss->getNumTextureAttributeLists(); ++unit ) + for( unsigned int unit = 0; unit < ss->getNumTextureAttributeLists(); ++unit ) { osg::Texture2D* tex = dynamic_cast ( @@ -194,8 +195,8 @@ class ReplaceStaticTextureVisitor: /* * remember this group for modification once the scenegraph has been traversed */ - groups_to_modify.push_back({parent, effectGeode->asNode(), unit}); - return; + groups_to_modify.push_back({ parent, &node, unit }); + return; } } /*