From 736823d032404a0cef68b7b0dc5b379052735d7c Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 14 Jan 2009 09:19:41 +0100 Subject: [PATCH] FGEnvironment: fix broken copy constructor. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Noticed by Csaba Halász. --- src/Environment/environment.cxx | 50 ++++++++++++++++++--------------- src/Environment/environment.hxx | 2 +- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/Environment/environment.cxx b/src/Environment/environment.cxx index 3e50bb459..c51752c55 100644 --- a/src/Environment/environment.cxx +++ b/src/Environment/environment.cxx @@ -118,33 +118,39 @@ _setup_tables () // Implementation of FGEnvironment. //////////////////////////////////////////////////////////////////////// -FGEnvironment::FGEnvironment() - : elevation_ft(0), - visibility_m(32000), - temperature_sea_level_degc(15), - temperature_degc(15), - dewpoint_sea_level_degc(5), // guess - dewpoint_degc(5), - pressure_sea_level_inhg(29.92), - pressure_inhg(29.92), - turbulence_magnitude_norm(0), - turbulence_rate_hz(1), - wind_from_heading_deg(0), - wind_speed_kt(0), - wind_from_north_fps(0), - wind_from_east_fps(0), - wind_from_down_fps(0), - altitude_half_to_sun_m(1000), - altitude_tropo_top_m(10000) +void FGEnvironment::_init() { - _setup_tables(); - _recalc_density(); - _recalc_relative_humidity(); + elevation_ft = 0; + visibility_m = 32000; + temperature_sea_level_degc = 15; + temperature_degc = 15; + dewpoint_sea_level_degc = 5; // guess + dewpoint_degc = 5; + pressure_sea_level_inhg = 29.92; + pressure_inhg = 29.92; + turbulence_magnitude_norm = 0; + turbulence_rate_hz = 1; + wind_from_heading_deg = 0; + wind_speed_kt = 0; + wind_from_north_fps = 0; + wind_from_east_fps = 0; + wind_from_down_fps = 0; + altitude_half_to_sun_m = 1000; + altitude_tropo_top_m = 10000; + _setup_tables(); + _recalc_density(); + _recalc_relative_humidity(); + +} + +FGEnvironment::FGEnvironment() +{ + _init(); } FGEnvironment::FGEnvironment (const FGEnvironment &env) { - FGEnvironment(); + _init(); copy(env); } diff --git a/src/Environment/environment.hxx b/src/Environment/environment.hxx index c952141bd..4d82685aa 100644 --- a/src/Environment/environment.hxx +++ b/src/Environment/environment.hxx @@ -98,7 +98,7 @@ public: virtual void set_altitude_tropo_top_m (double alt); private: - + void _init(); void _recalc_hdgspd (); void _recalc_ne ();