- } else if ( protocol == "multiplay" ) {
- if ( tokens.size() != 5 ) {
- SG_LOG( SG_IO, SG_ALERT, "Ignoring invalid --multiplay option "
- "(4 arguments expected: --multiplay=dir,hz,hostname,port)" );
- return NULL;
- }
- string dir = tokens[1];
- string rate = tokens[2];
- string host = tokens[3];
- string port = tokens[4];
- return new FGMultiplay(dir, atoi(rate.c_str()), host, atoi(port.c_str()));
- } else {
- return NULL;
- }
+ } else if ( protocol == "multiplay" ) {
+ if ( tokens.size() != 5 ) {
+ SG_LOG( SG_IO, SG_ALERT, "Ignoring invalid --multiplay option "
+ "(4 arguments expected: --multiplay=dir,hz,hostname,port)" );
+ return NULL;
+ }
+ string dir = tokens[1];
+ int rate = atoi(tokens[2].c_str());
+ string host = tokens[3];
+
+ short port = atoi(tokens[4].c_str());
+
+ // multiplay used to be handled by an FGProtocol, but no longer. This code
+ // retains compatibility with existing command-line syntax
+ fgSetInt("/sim/multiplay/tx-rate-hz", rate);
+ if (dir == "in") {
+ fgSetInt("/sim/multiplay/rxport", port);
+ fgSetString("/sim/multiplay/rxhost", host.c_str());
+ } else if (dir == "out") {
+ fgSetInt("/sim/multiplay/txport", port);
+ fgSetString("/sim/multiplay/txhost", host.c_str());
+ }
+
+ return NULL;
+ }
+#ifdef FG_HAVE_HLA
+ else if ( protocol == "hla" ) {
+ return new FGHLA(tokens);
+ }
+ else if ( protocol == "hla-local" ) {
+ // This is just about to bring up some defaults
+ if (tokens.size() != 2) {
+ SG_LOG( SG_IO, SG_ALERT, "Ignoring invalid --hla-local option "
+ "(one argument expected: --hla-local=<federationname>" );
+ return NULL;
+ }
+ tokens.insert(tokens.begin(), "");
+ tokens.insert(tokens.begin(), "60");
+ tokens.insert(tokens.begin(), "bi");
+ tokens.push_back("fg-local.xml");
+ return new FGHLA(tokens);
+ }
+#endif
+ else {
+ return NULL;
+ }