-// FGTransmission - a class to provide transmission control at larger airports.\r
-//\r
-// Written by Alexander Kappes, started March 2002.\r
-// Based on ground.cxx by David Luff, started March 2002.\r
-//\r
-// Copyright (C) 2002 David C. Luff - david.luff@nottingham.ac.uk\r
-//\r
-// This program is free software; you can redistribute it and/or\r
-// modify it under the terms of the GNU General Public License as\r
-// published by the Free Software Foundation; either version 2 of the\r
-// License, or (at your option) any later version.\r
-//\r
-// This program is distributed in the hope that it will be useful, but\r
-// WITHOUT ANY WARRANTY; without even the implied warranty of\r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
-// General Public License for more details.\r
-//\r
-// You should have received a copy of the GNU General Public License\r
-// along with this program; if not, write to the Free Software\r
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
-\r
-#include "transmission.hxx"\r
-\r
-#include <simgear/misc/sg_path.hxx>\r
-\r
-\r
-//Constructor\r
-FGTransmission::FGTransmission(){\r
-}\r
-\r
-//Destructor\r
-FGTransmission::~FGTransmission(){\r
-}\r
-\r
-void FGTransmission::Init() {\r
-}\r
-\r
-// ============================================================================\r
-// extract parameters from transmission\r
-// ============================================================================\r
-TransPar FGTransmission::Parse() {\r
- TransPar tpar;\r
- string tokens[20];\r
- int msglen,toklen;\r
- char dum;\r
- int i,j,k;\r
- const char *capl = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";\r
-\r
- msglen = strlen( TransText.c_str() );\r
-\r
- int tkn = 0;\r
- for ( i=0; i < msglen; ++i ) {\r
- if ( TransText.c_str()[i] != ' ' ) {\r
- if ( TransText.c_str()[i] != ',' ) tokens[tkn] += TransText.c_str()[i];\r
- } else if ( tokens[tkn] != "" ) {\r
- if ( tkn <= 20 ) {\r
- tkn += 1;\r
- } else {\r
- cout << "Too many tokens" << endl;\r
- }\r
- }\r
- }\r
-\r
- for ( i=0; i<20; ++i) {\r
- \r
- if ( tokens[i] == "request" ) {\r
- tpar.request = true;\r
- } else if ( tokens[i] == "approach" ) { \r
- tpar.station = "approach";\r
- tpar.airport = tokens[i-1];\r
- } else if ( tokens[i] == "landing" ) { \r
- tpar.intention = "landing";\r
- for ( j=i+1; j<=i+2; ++j ) {\r
- if ( tokens[j] != "" ) {\r
- toklen = strlen( tokens[j].c_str() );\r
- bool aid = true;\r
- for ( k=0; k<toklen; ++k )\r
- if ( ! strpbrk( &tokens[j].c_str()[k], capl )) {\r
- aid = false;\r
- break;\r
- }\r
- if ( aid ) tpar.intid = tokens[j];\r
- }\r
- }\r
- } else if ( tokens[i] == "Player" ) { \r
- tpar.callsign = tokens[i];\r
- }\r
- }\r
-\r
- //cout << tpar.airport << endl;\r
- //cout << tpar.request << endl;\r
- //cout << tpar.intention << endl;\r
- //cout << tpar.intid << endl;\r
-\r
- return tpar;\r
-}\r
+// FGTransmission - a class to provide transmission control at larger airports.
+//
+// Written by Alexander Kappes, started March 2002.
+// Based on ground.cxx by David Luff, started March 2002.
+//
+// Copyright (C) 2002 David C. Luff - david.luff@nottingham.ac.uk
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+#include "transmission.hxx"
+
+#include <simgear/misc/sg_path.hxx>
+
+
+//Constructor
+FGTransmission::FGTransmission(){
+}
+
+//Destructor
+FGTransmission::~FGTransmission(){
+}
+
+void FGTransmission::Init() {
+}
+
+// ============================================================================
+// extract parameters from transmission
+// ============================================================================
+TransPar FGTransmission::Parse() {
+ TransPar tpar;
+ string tokens[20];
+ int msglen,toklen;
+ char dum;
+ int i,j,k;
+ const char *capl = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+ msglen = strlen( TransText.c_str() );
+
+ int tkn = 0;
+ for ( i=0; i < msglen; ++i ) {
+ if ( TransText.c_str()[i] != ' ' ) {
+ if ( TransText.c_str()[i] != ',' ) tokens[tkn] += TransText.c_str()[i];
+ } else if ( !tokens[tkn].empty() ) {
+ if ( tkn <= 20 ) {
+ tkn += 1;
+ } else {
+ cout << "Too many tokens" << endl;
+ }
+ }
+ }
+
+ for ( i=0; i<20; ++i) {
+
+ if ( tokens[i] == "request" ) {
+ tpar.request = true;
+ } else if ( tokens[i] == "approach" ) {
+ tpar.station = "approach";
+ tpar.airport = tokens[i-1];
+ } else if ( tokens[i] == "landing" ) {
+ tpar.intention = "landing";
+ for ( j=i+1; j<=i+2; ++j ) {
+ if ( !tokens[j].empty() ) {
+ toklen = strlen( tokens[j].c_str() );
+ bool aid = true;
+ for ( k=0; k<toklen; ++k )
+ if ( ! strpbrk( &tokens[j].c_str()[k], capl )) {
+ aid = false;
+ break;
+ }
+ if ( aid ) tpar.intid = tokens[j];
+ }
+ }
+ } else if ( tokens[i] == "Player" ) {
+ tpar.callsign = tokens[i];
+ }
+ }
+
+ //cout << tpar.airport << endl;
+ //cout << tpar.request << endl;
+ //cout << tpar.intention << endl;
+ //cout << tpar.intid << endl;
+
+ return tpar;
+}