Hi,

I am trying to develop a radar module which consists of two 'texture'
classes that are overlaid.

The classes are instantiated within instrument_manager:

        } else if ( name == "taradar" ) {
            set_subsystem( id, new TaRadar( node ), 1 );

        } else if ( name == "taecho" ) {
            set_subsystem( id, new TaEcho( node ), 1 );

and the objects perform as i would expect within flightgear.

next, I wish to call a method (TaRadar::getAngle) from within TaEcho, so to
do this, I assume that i do something like:

TaRadar* _taradar_node = (TaRadar*) globals->get_subsystem("
taradar");
cout << "angle: " << _taradar_node->getAngle << endl;
  OR (neither work)
FGInstrumentMgr *imgr = (FGInstrumentMgr *)
globals->get_subsystem("instrumentation");
_taradar_node = (TaRadar *) imgr->get_subsystem("taradar");
cout << "angle: " << _taradar_node->getAngle << endl;

Now then, if TaRadar::getAngle() has the following fixed code:

return 10;

everything works ok, but if the method returns an object variable:

return _angle;

I get a segmentation fault.  I assume this to be because the private
variable (_angle) has not been initialised, however, i even tried setting
the value to a fixed value within the constructor and it still does not
work.

constructor:

TaRadar::TaRadar(SGPropertyNode *node) {
    cout << "TaRadar initialise" << endl;
    _angle=5; //(declared in .hxx as float _angle;)
}

Does anybody know why this variable is appearing to be not initialised? am i
calling the wrong function to return a pointer to this object?

Thanks for any help
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to