#include <simgear/structure/exception.hxx>
#include <string>
-#include <math.h>
-#include <time.h>
-
-#ifdef _MSC_VER
-# include <float.h>
-# define isfinite(x) _finite(x)
-#else
-# define isfinite(x) std::isfinite(x)
-#endif
+#include <cmath>
+#include <ctime>
+// defined in AIShip.cxx
+extern double fgIsFinite(double x);
#include "AIAircraft.hxx"
#include "performancedata.hxx"
SG_NORMALIZE_RANGE(calc_bearing, 0.0, 360.0);
}
- if (isfinite(calc_bearing)) {
+ if (fgIsFinite(calc_bearing)) {
double hdg_error = calc_bearing - tgt_heading;
if (fabs(hdg_error) > 0.01) {
TurnTo( calc_bearing );
# include <config.h>
#endif
+#include <cmath>
+
#ifdef _MSC_VER
# include <float.h>
-# define isfinite(x) _finite(x)
+ double fgIsFinite(double x) { return _finite(x); }
#else
-# define isfinite(x) std::isfinite(x)
+ double fgIsFinite(double x) { return std::isfinite(x); }
#endif
-#include <math.h>
-
#include <simgear/sg_inlines.h>
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/timing/sg_time.hxx>
// now revise the required course for the next way point
_course = getCourse(pos.getLatitudeDeg(), pos.getLongitudeDeg(), curr->getLatitude(), curr->getLongitude());
- if (isfinite(_course))
+ if (fgIsFinite(_course))
TurnTo(_course);
else
SG_LOG(SG_AI, SG_ALERT, "AIShip: Bearing or Range is not a finite number");