Maik Justus:
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).
This commit is contained in:
parent
b9e4775a7a
commit
5d18c09c08
3 changed files with 8 additions and 2 deletions
|
@ -138,8 +138,8 @@ void Turbulence::getTurbulence(double* loc, float alt, float* up,
|
||||||
double b = (loc[1] + _off[1]) + _timeOff;
|
double b = (loc[1] + _off[1]) + _timeOff;
|
||||||
a -= _sz * Math::floor(a * (1.0/_sz));
|
a -= _sz * Math::floor(a * (1.0/_sz));
|
||||||
b -= _sz * Math::floor(b * (1.0/_sz));
|
b -= _sz * Math::floor(b * (1.0/_sz));
|
||||||
int x = (int)Math::floor(a);
|
int x = ((int)Math::floor(a))&(_sz-1);
|
||||||
int y = (int)Math::floor(b);
|
int y = ((int)Math::floor(b))&(_sz-1);
|
||||||
|
|
||||||
// Convert to fractional interpolation factors
|
// Convert to fractional interpolation factors
|
||||||
a -= x;
|
a -= x;
|
||||||
|
|
|
@ -54,6 +54,11 @@ YASim::YASim(double dt)
|
||||||
_fdm->getAirplane()->getModel()->getIntegrator()->setInterval(_dt);
|
_fdm->getAirplane()->getModel()->getIntegrator()->setInterval(_dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
YASim::~YASim()
|
||||||
|
{
|
||||||
|
delete _fdm;
|
||||||
|
}
|
||||||
|
|
||||||
void YASim::report()
|
void YASim::report()
|
||||||
{
|
{
|
||||||
Airplane* a = _fdm->getAirplane();
|
Airplane* a = _fdm->getAirplane();
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace yasim { class FGFDM; };
|
||||||
class YASim : public FGInterface {
|
class YASim : public FGInterface {
|
||||||
public:
|
public:
|
||||||
YASim(double dt);
|
YASim(double dt);
|
||||||
|
~YASim();
|
||||||
|
|
||||||
// Load externally set stuff into the FDM
|
// Load externally set stuff into the FDM
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
Loading…
Reference in a new issue