remove redundant checks (and one indentation level)
This commit is contained in:
parent
db2d4a7a68
commit
845323eadd
1 changed files with 40 additions and 44 deletions
|
@ -301,29 +301,27 @@ TACAN::search (double frequency_mhz, double longitude_rad,
|
|||
number = carrier.size();
|
||||
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, "carrier " << number );
|
||||
if ( number > 0 ) { // don't do this if there are no carriers
|
||||
for ( i = 0; i < number; ++i ) {
|
||||
string str2 ( carrier[i]->getStringValue("name", ""));
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, "carrier name " << str2 );
|
||||
for ( i = 0; i < number; ++i ) {
|
||||
string str2 ( carrier[i]->getStringValue("name", ""));
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, "carrier name " << str2 );
|
||||
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, "strings 1 " << str1 << " 2 " << str2 );
|
||||
string::size_type loc1= str1.find( str2, 0 );
|
||||
if ( loc1 != string::npos && str2 != "" ) {
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, " string found" );
|
||||
_mobile_lat = carrier[i]->getDoubleValue("position/latitude-deg");
|
||||
_mobile_lon = carrier[i]->getDoubleValue("position/longitude-deg");
|
||||
_mobile_elevation_ft = mobile_tacan->get_elev_ft();
|
||||
_mobile_range_nm = mobile_tacan->get_range();
|
||||
_mobile_bias = mobile_tacan->get_multiuse();
|
||||
_mobile_name = mobile_tacan->name();
|
||||
_mobile_ident = mobile_tacan->get_trans_ident();
|
||||
_mobile_valid = true;
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, " carrier transmitter valid " << _mobile_valid );
|
||||
break;
|
||||
} else {
|
||||
_mobile_valid = false;
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, " carrier transmitter invalid " << _mobile_valid );
|
||||
}
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, "strings 1 " << str1 << " 2 " << str2 );
|
||||
string::size_type loc1= str1.find( str2, 0 );
|
||||
if ( loc1 != string::npos && str2 != "" ) {
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, " string found" );
|
||||
_mobile_lat = carrier[i]->getDoubleValue("position/latitude-deg");
|
||||
_mobile_lon = carrier[i]->getDoubleValue("position/longitude-deg");
|
||||
_mobile_elevation_ft = mobile_tacan->get_elev_ft();
|
||||
_mobile_range_nm = mobile_tacan->get_range();
|
||||
_mobile_bias = mobile_tacan->get_multiuse();
|
||||
_mobile_name = mobile_tacan->name();
|
||||
_mobile_ident = mobile_tacan->get_trans_ident();
|
||||
_mobile_valid = true;
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, " carrier transmitter valid " << _mobile_valid );
|
||||
break;
|
||||
} else {
|
||||
_mobile_valid = false;
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, " carrier transmitter invalid " << _mobile_valid );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,29 +337,27 @@ TACAN::search (double frequency_mhz, double longitude_rad,
|
|||
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, "tanker number " << number );
|
||||
|
||||
if ( number > 0 ) { // don't do this if there are no AI aircraft
|
||||
for ( i = 0; i < number; ++i ) {
|
||||
string str4 ( tanker[i]->getStringValue("callsign", ""));
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, "tanker callsign " << str4 );
|
||||
for ( i = 0; i < number; ++i ) {
|
||||
string str4 ( tanker[i]->getStringValue("callsign", ""));
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, "tanker callsign " << str4 );
|
||||
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, "strings 1 " << str1 << " 4 " << str4 );
|
||||
string::size_type loc1= str1.find( str4, 0 );
|
||||
if ( loc1 != string::npos && str4 != "" ) {
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, " string found" );
|
||||
_mobile_lat = tanker[i]->getDoubleValue("position/latitude-deg");
|
||||
_mobile_lon = tanker[i]->getDoubleValue("position/longitude-deg");
|
||||
_mobile_elevation_ft = tanker[i]->getDoubleValue("position/altitude-ft");
|
||||
_mobile_range_nm = mobile_tacan->get_range();
|
||||
_mobile_bias = mobile_tacan->get_multiuse();
|
||||
_mobile_name = mobile_tacan->name();
|
||||
_mobile_ident = mobile_tacan->get_trans_ident();
|
||||
_mobile_valid = true;
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, " tanker transmitter valid " << _mobile_valid );
|
||||
break;
|
||||
} else {
|
||||
_mobile_valid = false;
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, " tanker transmitter invalid " << _mobile_valid );
|
||||
}
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, "strings 1 " << str1 << " 4 " << str4 );
|
||||
string::size_type loc1= str1.find( str4, 0 );
|
||||
if ( loc1 != string::npos && str4 != "" ) {
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, " string found" );
|
||||
_mobile_lat = tanker[i]->getDoubleValue("position/latitude-deg");
|
||||
_mobile_lon = tanker[i]->getDoubleValue("position/longitude-deg");
|
||||
_mobile_elevation_ft = tanker[i]->getDoubleValue("position/altitude-ft");
|
||||
_mobile_range_nm = mobile_tacan->get_range();
|
||||
_mobile_bias = mobile_tacan->get_multiuse();
|
||||
_mobile_name = mobile_tacan->name();
|
||||
_mobile_ident = mobile_tacan->get_trans_ident();
|
||||
_mobile_valid = true;
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, " tanker transmitter valid " << _mobile_valid );
|
||||
break;
|
||||
} else {
|
||||
_mobile_valid = false;
|
||||
SG_LOG( SG_INSTR, SG_DEBUG, " tanker transmitter invalid " << _mobile_valid );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue