-
- while ( r.id == id ) {
- // forward direction
- if ( r.rwy_no == runway ) {
- found_r = r;
- heading = r.heading;
- match = true;
- SG_LOG( SG_GENERAL, SG_INFO,
- "Runway " << r.rwy_no << " heading = " << heading );
- }
-
- // calculate reciprocal runway number
- string snum = r.rwy_no;
- int len = snum.length();
- string letter = "";
- string rev_letter = "";
- int i;
- for ( i = 0; i < len; ++i ) {
- string tmp = snum.substr(i, 1);
- if ( tmp == "L" ) {
- letter = "L";
- rev_letter = "R";
- } else if ( tmp == "R" ) {
- letter = "R";
- rev_letter = "L";
- } else if ( tmp == "C" ) {
- letter == "C";
- rev_letter = "C";
- }
- }
- for ( i = 0; i < len; ++i ) {
- string tmp = snum.substr(i, 1);
- if ( tmp == "L" || tmp == "R" || tmp == "C" || tmp == " " ) {
- snum = snum.substr(0, i);
- }
- }
- SG_LOG(SG_GENERAL, SG_DEBUG, "Runway num = '" << snum << "'");
- int num = atoi( snum.c_str() ) + 18;
- while ( num > 36 ) { num -= 36; }
- while ( num <= 0 ) { num += 36; }
-
- char recip_no[10];
- snprintf( recip_no, 10, "%02d%s", num, rev_letter.c_str() );
-
- // reverse direction
- if ( (string)recip_no == runway ) {
- found_r = r;
- heading = r.heading + 180;
- while ( heading > 360.0 ) { heading -= 360; }
- match = true;
- SG_LOG( SG_GENERAL, SG_INFO,
- "Runway " << r.rwy_no << " heading = " << heading );
- }
-
- runways.next( &r );
- }