1
0
Fork 0

In the situation where a class gets deleted, the _slef pointer is set to 0. Make sure we check for that situation before using it.

This commit is contained in:
ehofman 2004-05-24 14:36:35 +00:00
parent 22cd6dfb2a
commit db22fb21c5
2 changed files with 47 additions and 21 deletions

View file

@ -90,9 +90,10 @@ private:
}; };
inline bool FGAIAircraft::_getGearDown() { inline bool FGAIAircraft::_getGearDown() {
return ((fgGetFloat("/position/altitude-agl-ft") < 150.0) return (!_self) ? false
&& (fgGetFloat("/velocities/airspeed-kt") : ((fgGetFloat("/position/altitude-agl-ft") < 150.0)
< _self->performance->land_speed*1.5)); && (fgGetFloat("/velocities/airspeed-kt")
< _self->performance->land_speed*1.5));
} }

View file

@ -174,33 +174,58 @@ inline void FGAIBase::setDie( bool die ) { delete_me = die; }
inline bool FGAIBase::getDie() { return delete_me; } inline bool FGAIBase::getDie() { return delete_me; }
inline void FGAIBase::_setLongitude( double longitude ) { inline void FGAIBase::_setLongitude( double longitude ) {
_self->pos.setlon(longitude); if (_self) _self->pos.setlon(longitude);
} }
inline void FGAIBase::_setLatitude ( double latitude ) { inline void FGAIBase::_setLatitude ( double latitude ) {
_self->pos.setlat(latitude); if (_self) _self->pos.setlat(latitude);
} }
inline double FGAIBase::_getLongitude() { return _self->pos.lon(); } inline double FGAIBase::_getLongitude() {
inline double FGAIBase::_getLatitude () { return _self->pos.lat(); } return (!_self) ? 0.0 :_self->pos.lon();
}
inline double FGAIBase::_getLatitude () {
return (!_self) ? 0.0 :_self->pos.lat();
}
inline double FGAIBase::_getBearing() {
return (!_self) ? 0.0 :_self->bearing;
}
inline double FGAIBase::_getElevation() {
return (!_self) ? 0.0 :_self->elevation;
}
inline double FGAIBase::_getRange() {
return (!_self) ? 0.0 :_self->range;
}
inline double FGAIBase::_getRdot() {
return (!_self) ? 0.0 :_self->rdot;
}
inline double FGAIBase::_getH_offset() {
return (!_self) ? 0.0 :_self->horiz_offset;
}
inline double FGAIBase::_getV_offset() {
return (!_self) ? 0.0 :_self->vert_offset;
}
inline double FGAIBase::_getX_shift() {
return (!_self) ? 0.0 :_self->x_shift;
}
inline double FGAIBase::_getY_shift() {
return (!_self) ? 0.0 :_self->y_shift;
}
inline double FGAIBase::_getRotation() {
return (!_self) ? 0.0 :_self->rotation;
}
inline double FGAIBase::_getBearing() { return _self->bearing; } inline double FGAIBase::_getVS_fps() {
inline double FGAIBase::_getElevation() { return _self->elevation; } return (!_self) ? 0.0 :_self->vs*60.0;
inline double FGAIBase::_getRange() { return _self->range; } }
inline double FGAIBase::_getRdot() { return _self->rdot; } inline void FGAIBase::_setVS_fps( double _vs ) {
inline double FGAIBase::_getH_offset() { return _self->horiz_offset; } if (_self) _self->vs = _vs/60.0;
inline double FGAIBase::_getV_offset() { return _self->vert_offset; } }
inline double FGAIBase::_getX_shift() { return _self->x_shift; }
inline double FGAIBase::_getY_shift() { return _self->y_shift; }
inline double FGAIBase::_getRotation() { return _self->rotation; }
inline double FGAIBase::_getVS_fps() { return _self->vs*60.0; }
inline void FGAIBase::_setVS_fps( double _vs ) { _self->vs = _vs/60.0; }
inline double FGAIBase::_getAltitude() { inline double FGAIBase::_getAltitude() {
return _self->altitude; return (!_self) ? 0.0 :_self->altitude;
} }
inline void FGAIBase::_setAltitude( double _alt ) { inline void FGAIBase::_setAltitude( double _alt ) {
_self->setAltitude( _alt ); if (_self) _self->setAltitude( _alt );
} }
inline bool FGAIBase::_isNight() { inline bool FGAIBase::_isNight() {