diff --git a/src/Radio/itm.cpp b/src/Radio/itm.cpp index 184ac3765..bf42ee2e8 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 e5719e0dc..fba504746 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); @@ -362,15 +362,16 @@ 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[10000]; + + int size = _elevations.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; }