# include <config.h>
#endif
+#include <cmath>
+
#ifdef _MSC_VER
# include <float.h>
-# define finite _finite
-#elif defined(__sun) || defined(sgi)
-# include <ieeefp.h>
+ double fgIsFinite(double x) { return _finite(x); }
+#else
+ 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>
#include "AIShip.hxx"
+using std::string;
FGAIShip::FGAIShip(object_type ot) :
// allow HOT to be enabled
setRudder(scFileNode->getFloatValue("rudder", 0.0));
setName(scFileNode->getStringValue("name", "Titanic"));
setRadius(scFileNode->getDoubleValue("turn-radius-ft", 2000));
- std::string flightplan = scFileNode->getStringValue("flightplan");
+ const std::string& flightplan = scFileNode->getStringValue("flightplan");
setRepeat(scFileNode->getBoolValue("repeat", false));
setRestart(scFileNode->getBoolValue("restart", false));
setStartTime(scFileNode->getStringValue("time", ""));
if (_fp_init)
ProcessFlightPlan(dt);
- string type = getTypeString();
+ const string& type = getTypeString();
double alpha;
double rudder_limit;
// now revise the required course for the next way point
_course = getCourse(pos.getLatitudeDeg(), pos.getLongitudeDeg(), curr->getLatitude(), curr->getLongitude());
- if (finite(_course))
+ if (fgIsFinite(_course))
TurnTo(_course);
else
SG_LOG(SG_AI, SG_ALERT, "AIShip: Bearing or Range is not a finite number");
if (curr->getOn_ground()){
if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(wppos, 3000),
- elevation_m, &_material, 0)){
+ elevation_m, NULL, 0)){
wppos.setElevationM(elevation_m);
}