1
0
Fork 0

Fix error caused by assert statement in itm.cpp

This commit is contained in:
adrian 2011-12-06 02:04:21 +02:00
parent f720f76456
commit b7d59463c8
2 changed files with 8 additions and 6 deletions

View file

@ -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;

View file

@ -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;i<size;i++) {
itm_elev[i]=_elevations[i];
//cerr << "ITM:: itm_elev: " << _elevations[i] << endl;
}
if((transmission_type == 3) || (transmission_type == 4)) {
// the sender and receiver roles are switched
point_to_point(itm_elev, receiver_height, transmitter_height,
@ -407,6 +408,7 @@ double FGRadioTransmission::ITM_calculate_attenuation(SGGeod pos, double freq, i
_root_node->setDoubleValue("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;
}