From b7d59463c8da1a6f5e669768e4a17a277eec00c0 Mon Sep 17 00:00:00 2001 From: adrian Date: Tue, 6 Dec 2011 02:04:21 +0200 Subject: [PATCH] Fix error caused by assert statement in itm.cpp --- src/Radio/itm.cpp | 2 +- src/Radio/radio.cxx | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Radio/itm.cpp b/src/Radio/itm.cpp index 1b970d067..28f7004b4 100644 --- a/src/Radio/itm.cpp +++ b/src/Radio/itm.cpp @@ -1378,7 +1378,7 @@ double dlthx(double pfl[], const double &x1, const double &x2) n = 10 * ka - 5; kb = n - ka + 1; sn = n - 1; - assert((s = new double[n+2]) != 0); + s = new double[n+2]; s[0] = sn; s[1] = 1.0; xb = (xb - xa) / sn; diff --git a/src/Radio/radio.cxx b/src/Radio/radio.cxx index 4c80a9fe5..efb5baf53 100644 --- a/src/Radio/radio.cxx +++ b/src/Radio/radio.cxx @@ -236,7 +236,7 @@ double FGRadioTransmission::ITM_calculate_attenuation(SGGeod pos, double freq, i double own_alt= own_alt_ft * SG_FEET_TO_METER; - //cerr << "ITM:: pilot Lat: " << own_lat << ", Lon: " << own_lon << ", Alt: " << own_alt << endl; + SGGeod own_pos = SGGeod::fromDegM( own_lon, own_lat, own_alt ); SGGeod max_own_pos = SGGeod::fromDegM( own_lon, own_lat, SG_MAX_ELEVATION_M ); @@ -253,7 +253,7 @@ double FGRadioTransmission::ITM_calculate_attenuation(SGGeod pos, double freq, i sender_alt = sender_alt_ft * SG_FEET_TO_METER; SGGeod max_sender_pos = SGGeod::fromGeodM( pos, SG_MAX_ELEVATION_M ); SGGeoc sender_pos_c = SGGeoc::fromGeod( sender_pos ); - //cerr << "ITM:: sender Lat: " << parent->getLatitude() << ", Lon: " << parent->getLongitude() << ", Alt: " << sender_alt << endl; + double point_distance= _terrain_sampling_distance; double course = SGGeodesy::courseRad(own_pos_c, sender_pos_c); @@ -363,12 +363,13 @@ double FGRadioTransmission::ITM_calculate_attenuation(SGGeod pos, double freq, i _elevations.push_front(point_distance); _elevations.push_front(num_points -1); int size = _elevations.size(); - double itm_elev[size]; + double *itm_elev; + itm_elev = new double[size]; for(int i=0;isetDoubleValue("station[0]/field-strength-uV", field_strength_uV); _root_node->setDoubleValue("station[0]/signal", signal); _root_node->setDoubleValue("station[0]/tx-erp", tx_erp); + delete[] itm_elev; return signal; }