diff --git a/src/Cockpit/radiostack.cxx b/src/Cockpit/radiostack.cxx index 81f4e3725..cf6d798af 100644 --- a/src/Cockpit/radiostack.cxx +++ b/src/Cockpit/radiostack.cxx @@ -83,13 +83,19 @@ FGRadioStack::FGRadioStack() : lat_node(fgGetNode("/position/latitude-deg", true)), alt_node(fgGetNode("/position/altitude-ft", true)), need_update(true), + nav1_freq(0.0), + nav1_alt_freq(0.0), nav1_radial(0.0), + nav2_freq(0.0), + nav2_alt_freq(0.0), nav2_radial(0.0), dme_freq(0.0), dme_dist(0.0), dme_prev_dist(0.0), dme_spd(0.0), - dme_ete(0.0) + dme_ete(0.0), + adf_freq(0.0), + adf_alt_freq(0.0) { SGPath path( globals->get_fg_root() ); SGPath term = path; diff --git a/src/Main/main.cxx b/src/Main/main.cxx index e1c20d716..892aeb4d0 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -113,8 +113,8 @@ // Should already be inlcluded by gl.h if needed by your platform so // we shouldn't include this here. // #include -PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT = 0; -PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvEXT = 0; +// PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT = 0; +// PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvEXT = 0; float default_attenuation[3] = {1.0, 0.0, 0.0}; //Required for using GL_extensions void fgLoadDCS (void); @@ -1866,16 +1866,24 @@ int mainLoop( int argc, char **argv ) { // Main entry point; catch any exceptions that have made it this far. int main ( int argc, char **argv ) { - // FIXME: add other, more specific - // exceptions. - try { - mainLoop(argc, argv); - } catch (sg_throwable &t) { - SG_LOG(SG_GENERAL, SG_ALERT, - "Fatal error: " << t.getFormattedMessage() - << "\n (received from " << t.getOrigin() << ')'); - exit(1); - } + +#ifdef _MSC_VER + // Christian, we should document what this does + _control87( _EM_INEXACT, _MCW_EM ); +#endif + + // FIXME: add other, more specific + // exceptions. + try { + mainLoop(argc, argv); + } catch (sg_throwable &t) { + SG_LOG(SG_GENERAL, SG_ALERT, + "Fatal error: " << t.getFormattedMessage() + << "\n (received from " << t.getOrigin() << ')'); + exit(1); + } + + return 0; } @@ -1966,7 +1974,7 @@ void fgLoadDCS(void) { SG_LOG( SG_TERRAIN, SG_ALERT, "Cannot open file: " << modelpath.str() ); } else { while ( ! in1.eof() ) { - in1 >> skipws; + in1 >> ::skipws; if ( in1.get( c ) && c == '#' ) { in1 >> skipeol; } else { diff --git a/src/Main/viewer.cxx b/src/Main/viewer.cxx index 8c75ed848..b723733ff 100644 --- a/src/Main/viewer.cxx +++ b/src/Main/viewer.cxx @@ -29,6 +29,7 @@ #endif #include +#include #include "viewer.hxx" @@ -40,6 +41,10 @@ FGViewer::FGViewer( void ): goal_view_offset(0.0) { sgSetVec3( pilot_offset, 0.0, 0.0, 0.0 ); + sgdZeroVec3(geod_view_pos); + sgdZeroVec3(abs_view_pos); + sea_level_radius = SG_EQUATORIAL_RADIUS_M; + //a reasonable guess for init, so that the math doesn't blow up } diff --git a/src/Navaids/ils.hxx b/src/Navaids/ils.hxx index d9d4c3ae1..b97b2882e 100644 --- a/src/Navaids/ils.hxx +++ b/src/Navaids/ils.hxx @@ -128,7 +128,12 @@ inline istream& operator >> ( istream& in, FGILS& i ) { double f; - in >> i.ilstype >> i.ilstypename >> i.aptcode >> i.rwyno + in >> i.ilstype; + + if ( i.ilstype == '[' ) + return in; + + in >> i.ilstypename >> i.aptcode >> i.rwyno >> f >> i.locident >> i.locheading >> i.loclat >> i.loclon >> i.gselev >> i.gsangle >> i.gslat >> i.gslon >> i.dmelat >> i.dmelon diff --git a/src/Navaids/nav.hxx b/src/Navaids/nav.hxx index b5563ee45..5a5211304 100644 --- a/src/Navaids/nav.hxx +++ b/src/Navaids/nav.hxx @@ -111,7 +111,12 @@ operator >> ( istream& in, FGNav& n ) first_time = false; } - in >> n.type >> n.lat >> n.lon >> n.elev >> f >> n.range + in >> n.type; + + if ( n.type == '[' ) + return in >> skipeol; + + in >> n.lat >> n.lon >> n.elev >> f >> n.range >> c >> n.ident >> magvar_s; n.freq = (int)(f*100.0 + 0.5); diff --git a/src/Scenery/hitlist.cxx b/src/Scenery/hitlist.cxx index e4a1e06f7..ca14e1965 100644 --- a/src/Scenery/hitlist.cxx +++ b/src/Scenery/hitlist.cxx @@ -199,6 +199,13 @@ int FGHitList::IntersectLeaf( ssgLeaf *leaf, sgdMat4 m, sgdXformPnt3( tri[1], leaf->getVertex( i2 ), m ); sgdXformPnt3( tri[2], leaf->getVertex( i3 ), m ); + //avoid division by zero when two points are the same + if ( sgdEqualVec3(tri[0], tri[1]) || + sgdEqualVec3(tri[1], tri[2]) || + sgdEqualVec3(tri[2], tri[0]) ) { + continue; + } + sgdVec4 plane; sgdMakePlane( plane, tri[0], tri[1], tri[2] );