From d0af0c5f58b2d7c00c3ad9d02363f95fd63a1c7b Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Dec 2003 19:02:48 +0000 Subject: [PATCH] Export a "/sim/crashed" property to indicate a crash. Yanked some ancient debug code and cleaned up some whitespace while I was in there. --- src/FDM/YASim/YASim.cxx | 43 +++++++++-------------------------------- src/FDM/YASim/YASim.hxx | 2 -- 2 files changed, 9 insertions(+), 36 deletions(-) diff --git a/src/FDM/YASim/YASim.cxx b/src/FDM/YASim/YASim.cxx index 91de304e8..88937ed2d 100644 --- a/src/FDM/YASim/YASim.cxx +++ b/src/FDM/YASim/YASim.cxx @@ -37,32 +37,6 @@ static const float W2HP = 1.3416e-3; static const float INHG2PA = 3386.389; static const float SLUG2KG = 14.59390; -void YASim::printDEBUG() -{ - static int debugCount = 0; - - debugCount++; - if(debugCount >= 3) { - debugCount = 0; - -// printf("N1 %5.1f N2 %5.1f FF %7.1f EPR %4.2f EGT %6.1f\n", -// fgGetFloat("/engines/engine[0]/n1"), -// fgGetFloat("/engines/engine[0]/n2"), -// fgGetFloat("/engines/engine[0]/fuel-flow-gph"), -// fgGetFloat("/engines/engine[0]/epr"), -// fgGetFloat("/engines/engine[0]/egt")); - -// printf("gear: %f\n", fgGetFloat("/controls/gear/gear-down")); - -// printf("alpha %5.1f beta %5.1f\n", get_Alpha()*57.3, get_Beta()*57.3); - -// printf("pilot: %f %f %f\n", -// fgGetDouble("/sim/view/pilot/x-offset-m"), -// fgGetDouble("/sim/view/pilot/y-offset-m"), -// fgGetDouble("/sim/view/pilot/z-offset-m")); - } -} - YASim::YASim(double dt) { // set_delta_t(dt); @@ -219,21 +193,22 @@ void YASim::init() void YASim::update(double dt) { if (is_suspended()) - return; + return; int iterations = _calc_multiloop(dt); // If we're crashed, then we don't care - if(_fdm->getAirplane()->getModel()->isCrashed()) - return; + if(_fdm->getAirplane()->getModel()->isCrashed()) { + if(!fgGetBool("/sim/crashed")) + fgSetBool("/sim/crashed", true); + return; + } int i; for(i=0; iiterate(_dt); - copyFromYASim(); - - printDEBUG(); + copyToYASim(false); + _fdm->iterate(_dt); + copyFromYASim(); } } diff --git a/src/FDM/YASim/YASim.hxx b/src/FDM/YASim/YASim.hxx index 935fb1903..00771fd04 100644 --- a/src/FDM/YASim/YASim.hxx +++ b/src/FDM/YASim/YASim.hxx @@ -22,8 +22,6 @@ public: void copyFromYASim(); void copyToYASim(bool copyState); - void printDEBUG(); - yasim::FGFDM* _fdm; float _dt; enum {