From: ehofman Date: Sun, 16 Oct 2005 09:05:40 +0000 (+0000) Subject: Ladislav Michnovic: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2631cf9cc5b6abe3c8b3ee18e78e7f9269b43449;p=flightgear.git Ladislav Michnovic: Using new gcc 4.0 I have some serios warnings about uninitialized variables, that are used. I created a patch, but I have no idea if it is possible to do it my way. Can you check this out please? Erik: I've modified the patch slightly based on the contents of an older version of hitlist.cxx. I think this is correct now. --- diff --git a/src/Cockpit/hud_rwy.cxx b/src/Cockpit/hud_rwy.cxx index 20a3832cf..880a0978f 100644 --- a/src/Cockpit/hud_rwy.cxx +++ b/src/Cockpit/hud_rwy.cxx @@ -352,6 +352,8 @@ bool runway_instr::boundOutsidePoints(sgdVec3 v, sgdVec3 m) { void runway_instr::drawArrow() { Point3D ac,rwy; + memset(&ac,0,sizeof(ac)); + memset(&rwy,0,sizeof(rwy)); ac.setlat(current_aircraft.fdm_state->get_Latitude_deg()); ac.setlon(current_aircraft.fdm_state->get_Longitude_deg()); rwy.setlat(runway._lat); diff --git a/src/FDM/Balloon/BalloonSim.cpp b/src/FDM/Balloon/BalloonSim.cpp index 76f9a5240..6047c41a9 100644 --- a/src/FDM/Balloon/BalloonSim.cpp +++ b/src/FDM/Balloon/BalloonSim.cpp @@ -201,8 +201,8 @@ void balloon::update() sgScaleVec3(fTotal, gravity_vector, mTotal); - sgAddVec3(fTotal, fLift); - sgAddVec3(fTotal, fFriction); + //sgAddVec3(fTotal, fLift); //FIXME: uninitialized fLift + //sgAddVec3(fTotal, fFriction); //FIXME: uninitialized fFriction //claculate acceleration: a = F / m sgVec3 aTotal, vTotal, dTotal; diff --git a/src/Scenery/hitlist.cxx b/src/Scenery/hitlist.cxx index 310d06190..3a7a46159 100644 --- a/src/Scenery/hitlist.cxx +++ b/src/Scenery/hitlist.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -633,7 +634,6 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m, int this_hit = -1; int max_hit = -1; - Point3D geoc; double hit_elev = -9999; double max_elev = -9999; Point3D sc(scenery_center[0], scenery_center[1], scenery_center[2]) ; @@ -668,7 +668,7 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m, if ( hit_elev > -9000 ) { *terrain_elev = hit_elev; - *radius = geoc.radius(); + *radius = sgCartToPolar3d(sc + hit_list->get_point(this_hit)).radius(); sgVec3 tmp; sgSetVec3(tmp, hit_list->get_normal(this_hit)); // cout << "cur_normal: " << tmp[0] << " " << tmp[1] << " " << tmp[2] << endl; @@ -726,7 +726,6 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m, int this_hit = -1; int max_hit = -1; - Point3D geoc; double hit_elev = -9999; double max_elev = -9999; Point3D sc(scenery_center[0], scenery_center[1], scenery_center[2]) ; @@ -752,6 +751,7 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m, max_hit = i; } } + if ( this_hit < 0 ) { // no hits below us, take the max hit @@ -761,7 +761,8 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m, if ( hit_elev > -9000 ) { *terrain_elev = hit_elev; - *radius = geoc.radius(); + *radius = sgCartToPolar3d(sc + hit_list->get_point(this_hit)).radius(); + sgVec3 tmp; sgSetVec3(tmp, hit_list->get_normal(this_hit)); // cout << "cur_normal: " << tmp[0] << " " << tmp[1] << " " << tmp[2] << endl;