From 1d99401c0427a2a4faae651995736d569f8bbd5e Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sun, 11 Nov 2012 17:22:42 +0100 Subject: [PATCH] Remove osg dependency for isNaN only. --- src/Instrumentation/gps.cxx | 3 +-- src/Model/modelmgr.cxx | 4 +--- src/MultiPlayer/multiplaymgr.cxx | 7 +++---- src/Navaids/positioned.cxx | 6 ++---- src/Scripting/NasalSys.cxx | 4 ++-- src/Scripting/nasal-props.cxx | 6 +++--- 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/Instrumentation/gps.cxx b/src/Instrumentation/gps.cxx index 6bc14228c..de071be0a 100644 --- a/src/Instrumentation/gps.cxx +++ b/src/Instrumentation/gps.cxx @@ -29,7 +29,6 @@ #include #include #include -#include using std::auto_ptr; using std::string; @@ -74,7 +73,7 @@ SGGeod SGGeodProperty::get() const double lon = _lon->getDoubleValue(), lat = _lat->getDoubleValue(); - if (osg::isNaN(lon) || osg::isNaN(lat)) { + if (SGMisc::isNaN(lon) || SGMisc::isNaN(lat)) { SG_LOG(SG_INSTR, SG_WARN, "read NaN for lon/lat:" << _lon->getPath() << ", " << _lat->getPath()); return SGGeod(); diff --git a/src/Model/modelmgr.cxx b/src/Model/modelmgr.cxx index 0310274bd..449c3bedc 100644 --- a/src/Model/modelmgr.cxx +++ b/src/Model/modelmgr.cxx @@ -18,8 +18,6 @@ #include #include -#include - #include #include #include @@ -150,7 +148,7 @@ namespace { double testNan(double val) throw (sg_range_exception) { - if (osg::isNaN(val)) + if (SGMisc::isNaN(val)) throw sg_range_exception("value is nan"); return val; } diff --git a/src/MultiPlayer/multiplaymgr.cxx b/src/MultiPlayer/multiplaymgr.cxx index 91b4d43ab..7d6ce8b33 100644 --- a/src/MultiPlayer/multiplaymgr.cxx +++ b/src/MultiPlayer/multiplaymgr.cxx @@ -35,7 +35,6 @@ #include #include #include -#include // isNaN #include #include @@ -302,7 +301,7 @@ namespace case props::DOUBLE: { float val = XDR_decode_float(*xdr); - if (osg::isNaN(val)) + if (SGMisc::isNaN(val)) return false; xdr++; break; @@ -611,8 +610,8 @@ FGMultiplayMgr::isSane(const FGExternalMotionData& motionInfo) { // check for corrupted data (NaNs) bool isCorrupted = false; - isCorrupted |= ((osg::isNaN(motionInfo.time )) || - (osg::isNaN(motionInfo.lag )) || + isCorrupted |= ((SGMisc::isNaN(motionInfo.time )) || + (SGMisc::isNaN(motionInfo.lag )) || (osg::isNaN(motionInfo.orientation(3) ))); for (unsigned i = 0; (i < 3)&&(!isCorrupted); ++i) { diff --git a/src/Navaids/positioned.cxx b/src/Navaids/positioned.cxx index 974f7a980..18bb22f62 100644 --- a/src/Navaids/positioned.cxx +++ b/src/Navaids/positioned.cxx @@ -33,8 +33,6 @@ #include #include -#include // for osg::isNaN - #include #include #include @@ -48,8 +46,8 @@ using namespace flightgear; static void validateSGGeod(const SGGeod& geod) { - if (osg::isNaN(geod.getLatitudeDeg()) || - osg::isNaN(geod.getLongitudeDeg())) + if (SGMisc::isNaN(geod.getLatitudeDeg()) || + SGMisc::isNaN(geod.getLongitudeDeg())) { throw sg_range_exception("position is invalid, NaNs"); } diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index 9bb1966e7..24b78b4e4 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -225,7 +225,7 @@ static naRef f_getprop(naContext c, naRef me, int argc, naRef* args) case props::DOUBLE: { double dv = p->getDoubleValue(); - if (osg::isNaN(dv)) { + if (SGMisc::isNaN(dv)) { SG_LOG(SG_NASAL, SG_ALERT, "Nasal getprop: property " << p->getPath() << " is NaN"); return naNil(); } @@ -280,7 +280,7 @@ static naRef f_setprop(naContext c, naRef me, int argc, naRef* args) if(naIsNil(n)) naRuntimeError(c, "setprop() value is not string or number"); - if (osg::isNaN(n.num)) { + if (SGMisc::isNaN(n.num)) { naRuntimeError(c, "setprop() passed a NaN"); } diff --git a/src/Scripting/nasal-props.cxx b/src/Scripting/nasal-props.cxx index 1d445174e..6112144f2 100644 --- a/src/Scripting/nasal-props.cxx +++ b/src/Scripting/nasal-props.cxx @@ -185,7 +185,7 @@ static naRef f_getValue(naContext c, naRef me, int argc, naRef* args) case props::DOUBLE: { double dv = (*node)->getDoubleValue(); - if (osg::isNaN(dv)) { + if (SGMisc::isNaN(dv)) { SG_LOG(SG_NASAL, SG_ALERT, "Nasal getValue: property " << (*node)->getPath() << " is NaN"); return naNil(); } @@ -242,7 +242,7 @@ static naRef f_setValue(naContext c, naRef me, int argc, naRef* args) naRuntimeError(c, "props.setValue() with non-number"); double d = naNumValue(val).num; - if (osg::isNaN(d)) { + if (SGMisc::isNaN(d)) { naRuntimeError(c, "props.setValue() passed a NaN"); } @@ -282,7 +282,7 @@ static naRef f_setDoubleValue(naContext c, naRef me, int argc, naRef* args) if (naIsNil(r)) naRuntimeError(c, "props.setDoubleValue() with non-number"); - if (osg::isNaN(r.num)) { + if (SGMisc::isNaN(r.num)) { naRuntimeError(c, "props.setDoubleValue() passed a NaN"); } -- 2.39.5