Hi,I found a small conspicuity in YASim. The destructor of the fdm was never called, therefore a modification of the heli fdm (not in cvs) did not work after reset (I tie some properties and untie them in the destructor, but the destructor was not called and the tieing failed after reset. I don't know if any other parts of YASim need their destructors, at least it wastes memory.
Another small fix I have made to the turbulence.cpp. The code needed, that (a-floor(a)) is >=0 and <1. This is analytical correct, but numerical only for "small" values. In normal fg-operation a in this function is always small, but with unrealistic parameters in the aircraft config file it is not and then fg crashes (instead a crash of the aircraft or cataputling it far away).
Please add this to cvs. Bets regards, Maik
Index: Turbulence.cpp =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/Turbulence.cpp,v retrieving revision 1.3 diff -u -p -r1.3 Turbulence.cpp --- Turbulence.cpp 12 Jan 2004 04:03:55 -0000 1.3 +++ Turbulence.cpp 9 Dec 2006 17:08:09 -0000 @@ -138,8 +138,8 @@ void Turbulence::getTurbulence(double* l double b = (loc[1] + _off[1]) + _timeOff; a -= _sz * Math::floor(a * (1.0/_sz)); b -= _sz * Math::floor(b * (1.0/_sz)); - int x = (int)Math::floor(a); - int y = (int)Math::floor(b); + int x = ((int)Math::floor(a))&(_sz-1); + int y = ((int)Math::floor(b))&(_sz-1); // Convert to fractional interpolation factors a -= x; Index: YASim.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/YASim.cxx,v retrieving revision 1.36 diff -u -p -r1.36 YASim.cxx --- YASim.cxx 28 Aug 2006 17:24:34 -0000 1.36 +++ YASim.cxx 9 Dec 2006 17:08:11 -0000 @@ -54,6 +54,11 @@ YASim::YASim(double dt) _fdm->getAirplane()->getModel()->getIntegrator()->setInterval(_dt); } +YASim::~YASim() +{ + delete _fdm; +} + void YASim::report() { Airplane* a = _fdm->getAirplane(); Index: YASim.hxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/YASim/YASim.hxx,v retrieving revision 1.3 diff -u -p -r1.3 YASim.hxx --- YASim.hxx 19 Dec 2003 19:02:48 -0000 1.3 +++ YASim.hxx 9 Dec 2006 17:08:11 -0000 @@ -8,6 +8,7 @@ namespace yasim { class FGFDM; }; class YASim : public FGInterface { public: YASim(double dt); + ~YASim(); // Load externally set stuff into the FDM virtual void init();
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel