]> git.mxchange.org Git - flightgear.git/blob - src/Main/options.cxx
Integrated FGOptions with the property manager (by David Megginson)
[flightgear.git] / src / Main / options.cxx
1 // options.cxx -- class to handle command line options
2 //
3 // Written by Curtis Olson, started April 1998.
4 //
5 // Copyright (C) 1998  Curtis L. Olson  - curt@me.umn.edu
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #ifdef HAVE_CONFIG_H
25 #  include <config.h>
26 #endif
27
28 #if defined(FX) && defined(XMESA)
29 bool global_fullscreen = true;
30 #endif
31
32 #include <simgear/compiler.h>
33
34 #include <math.h>            // rint()
35 #include <stdio.h>
36 #include <stdlib.h>          // atof(), atoi()
37 #include <string.h>
38
39 #include STL_STRING
40
41 #include <simgear/constants.h>
42 #include <simgear/debug/logstream.hxx>
43 #include <simgear/misc/fgstream.hxx>
44 #include <simgear/misc/props.hxx>
45 #include <simgear/timing/sg_time.hxx>
46
47 #include <Include/general.hxx>
48 #include <Airports/simple.hxx>
49 #include <Cockpit/cockpit.hxx>
50 #include <FDM/flight.hxx>
51 #include <FDM/UIUCModel/uiuc_aircraftdir.h>
52 #ifdef FG_NETWORK_OLK
53 #  include <NetworkOLK/network.h>
54 #endif
55
56 #include "fg_init.hxx"
57 #include "globals.hxx"
58 #include "options.hxx"
59
60 FG_USING_STD(string);
61 FG_USING_NAMESPACE(std);
62
63 // from main.cxx
64 extern void fgReshape( int width, int height );
65
66 inline double
67 atof( const string& str )
68 {
69
70 #ifdef __MWERKS__ 
71     // -dw- if ::atof is called, then we get an infinite loop
72     return std::atof( str.c_str() );
73 #else
74     return ::atof( str.c_str() );
75 #endif
76 }
77
78 inline int
79 atoi( const string& str )
80 {
81 #ifdef __MWERKS__ 
82     // -dw- if ::atoi is called, then we get an infinite loop
83     return std::atoi( str.c_str() );
84 #else
85     return ::atoi( str.c_str() );
86 #endif
87 }
88
89
90 // Defined the shared options class here
91 // FGOptions current_options;
92
93 #define PROP(name) (globals->get_props()->getValue(name, true))
94
95
96 // Constructor
97 FGOptions::FGOptions() 
98 {
99     char* envp = ::getenv( "FG_ROOT" );
100
101     if ( envp != NULL ) {
102         // fg_root could be anywhere, so default to environmental
103         // variable $FG_ROOT if it is set.
104         globals->set_fg_root(envp);
105     } else {
106         // Otherwise, default to a random compiled-in location if
107         // $FG_ROOT is not set.  This can still be overridden from the
108         // command line or a config file.
109
110 #if defined( WIN32 )
111         globals->set_fg_root("\\FlightGear");
112 #elif defined( macintosh )
113         globals->set_fg_root("");
114 #else
115         globals->set_fg_root(PKGLIBDIR);
116 #endif
117     }
118
119     // set a possibly independent location for scenery data
120     envp = ::getenv( "FG_SCENERY" );
121
122     if ( envp != NULL ) {
123         // fg_root could be anywhere, so default to environmental
124         // variable $FG_ROOT if it is set.
125         globals->set_fg_scenery(envp);
126     } else {
127         // Otherwise, default to Scenery being in $FG_ROOT/Scenery
128         globals->set_fg_scenery("");
129     }
130 }
131
132 void
133 FGOptions::init ()
134 {
135                                 // These are all deprecated, and will
136                                 // be removed gradually.
137   airport_id = PROP("/sim/startup/airport-id");
138   lon = PROP("/position/longitude");
139   lat = PROP("/position/latitude");
140   altitude = PROP("/position/altitude");
141   heading = PROP("/orientation/heading");
142   roll = PROP("/orientation/roll");
143   pitch = PROP("/orientation/pitch");
144   speedset = PROP("/sim/startup/speed-set");
145   uBody = PROP("/velocities/uBody");
146   vBody = PROP("/velocities/vBody");
147   wBody = PROP("/velocities/wBody");
148   vNorth = PROP("/velocities/speed-north");
149   vEast = PROP("/velocities/speed-east");
150   vDown = PROP("/velocities/speed-down");
151   vkcas = PROP("/velocities/knots");
152   mach = PROP("/velocities/mach");
153   game_mode = PROP("/sim/startup/game-mode");
154   splash_screen = PROP("/sim/startup/splash-screen");
155   intro_music = PROP("/sim/startup/intro-music");
156   mouse_pointer = PROP("/sim/startup/mouse-pointer");
157   control_mode = PROP("/sim/control-mode");
158   auto_coordination = PROP("/sim/auto-coordination");
159   hud_status = PROP("/sim/hud/visibility");
160   panel_status = PROP("/sim/panel/visibility");
161   sound = PROP("/sim/sound");
162   anti_alias_hud = PROP("/sim/hud/antialiased");
163   flight_model = PROP("/sim/flight-model");
164   aircraft = PROP("/sim/aircraft");
165   model_hz = PROP("/sim/model-hz");
166   speed_up = PROP("/sim/speed-up");
167   trim = PROP("/sim/startup/trim");
168   fog = PROP("/sim/rendering/fog");
169   clouds = PROP("/environment/clouds/enabled");
170   clouds_asl = PROP("/environments/clouds/altitude");
171   fullscreen = PROP("/sim/startup/fullscreen");
172   shading = PROP("/sim/rendering/shading");
173   skyblend = PROP("/sim/rendering/skyblend");
174   textures = PROP("/sim/rendering/textures");
175   wireframe = PROP("/sim/rendering/wireframe");
176   xsize = PROP("/sim/startup/xsize");
177   ysize = PROP("/sim/startup/ysize");
178   bpp = PROP("/sim/rendering/bits-per-pixel");
179   view_mode = PROP("/sim/view-mode");
180   default_view_offset = PROP("/sim/startup/view-offset");
181   visibility = PROP("/environment/visibility");
182   units = PROP("/sim/startup/units");
183   tris_or_culled = PROP("/sim/hud/frame-stat-type");
184   time_offset = PROP("/sim/startup/time-offset");
185   time_offset_type = PROP("/sim/startup/time-offset-type");
186   network_olk = PROP("/sim/networking/network-olk");
187   net_id = PROP("/sim/networking/call-sign");
188 }
189
190
191 /**
192  * Set a few fail-safe default property values.
193  *
194  * These should all be set in $FG_ROOT/preferences.xml, but just
195  * in case, we provide some initial sane values here. This method 
196  * should be invoked *before* reading any init files.
197  */
198 void
199 FGOptions::set_default_props ()
200 {
201   SGPropertyNode * props = globals->get_props();
202
203                                 // Position (Globe, AZ)
204   props->setDoubleValue("/position/longitude", -110.6642444);
205   props->setDoubleValue("/position/latitude", 33.3528917);
206   props->setDoubleValue("/position/altitude", -9999.0);
207
208                                 // Orientation
209   props->setDoubleValue("/orientation/heading", 270);
210   props->setDoubleValue("/orientation/roll", 0);
211   props->setDoubleValue("/orientation/pitch", 0.424);
212
213                                 // Velocities
214   props->setStringValue("/sim/startup/speed-set", "knots");
215   props->setDoubleValue("/velocities/uBody", 0.0);
216   props->setDoubleValue("/velocities/vBody", 0.0);
217   props->setDoubleValue("/velocities/wBody", 0.0);
218   props->setDoubleValue("/velocities/speed-north", 0.0);
219   props->setDoubleValue("/velocities/speed-east", 0.0);
220   props->setDoubleValue("/velocities/speed-down", 0.0);
221   props->setDoubleValue("/velocities/airspeed", 0.0);
222   props->setDoubleValue("/velocities/mach", 0.0);
223
224                                 // Miscellaneous
225   props->setBoolValue("/sim/startup/game-mode", false);
226   props->setBoolValue("/sim/startup/splash-screen", true);
227   props->setBoolValue("/sim/startup/intro-music", true);
228   props->setStringValue("/sim/startup/mouse-pointer", "disabled");
229   props->setStringValue("/sim/control-mode", "joystick");
230   props->setBoolValue("/sim/auto-coordination", false);
231
232                                 // Features
233   props->setBoolValue("/sim/hud/visibility", false);
234   props->setBoolValue("/sim/panel/visibility", true);
235   props->setBoolValue("/sim/sound", true);
236   props->setBoolValue("/sim/hud/antialiased", false);
237
238                                 // Flight Model options
239   props->setStringValue("/sim/flight-model", "larcsim");
240   props->setStringValue("/sim/aircraft", "c172");
241   props->setIntValue("/sim/model-hz", NEW_DEFAULT_MODEL_HZ);
242   props->setIntValue("/sim/speed-up", 1);
243   props->setBoolValue("/sim/startup/trim", false);
244
245                                 // Rendering options
246   props->setStringValue("/sim/rendering/fog", "nicest");
247   props->setBoolValue("/environment/clouds/enabled", true);
248   props->setDoubleValue("/environment/clouds/altitude", 5000);
249   props->setBoolValue("/sim/startup/fullscreen", false);
250   props->setBoolValue("/sim/rendering/shading", true);
251   props->setBoolValue("/sim/rendering/skyblend", true);
252   props->setBoolValue("/sim/rendering/textures", true);
253   props->setBoolValue("/sim/rendering/wireframe", false);
254   props->setIntValue("/sim/startup/xsize", 800);
255   props->setIntValue("/sim/startup/ysize", 600);
256   props->setIntValue("/sim/rendering/bits-per-pixel", 16);
257   props->setIntValue("/sim/view-mode", (int)FG_VIEW_PILOT);
258   props->setDoubleValue("/sim/startup/view-offset", 0);
259   props->setDoubleValue("/environment/visibility", 20000);
260
261                                 // HUD options
262   props->setStringValue("/sim/startup/units", "feet");
263   props->setStringValue("/sim/hud/frame-stat-type", "tris");
264         
265                                 // Time options
266   props->setIntValue("/sim/startup/time-offset", 0);
267
268   props->setBoolValue("/sim/networking/network-olk", false);
269   props->setStringValue("/sim/networking/call-sign", "Johnny");
270 }
271
272 void 
273 FGOptions::toggle_panel() {
274     SGPropertyNode * props = globals->get_props();
275     bool freeze = globals->get_freeze();
276
277     if( !freeze )
278         globals->set_freeze(true);
279     
280     if(props->getBoolValue("/sim/panel/visibility"))
281         props->setBoolValue("/sim/panel/visibility", false);
282     else
283       props->setBoolValue("/sim/panel/visibility", true);
284
285     fgReshape(props->getIntValue("/sim/startup/xsize"),
286               props->getIntValue("/sim/startup/ysize"));
287
288     if( !freeze )
289         globals->set_freeze( false );
290 }
291
292 double
293 FGOptions::parse_time(const string& time_in) {
294     char *time_str, num[256];
295     double hours, minutes, seconds;
296     double result = 0.0;
297     int sign = 1;
298     int i;
299
300     time_str = (char *)time_in.c_str();
301
302     // printf("parse_time(): %s\n", time_str);
303
304     // check for sign
305     if ( strlen(time_str) ) {
306         if ( time_str[0] == '+' ) {
307             sign = 1;
308             time_str++;
309         } else if ( time_str[0] == '-' ) {
310             sign = -1;
311             time_str++;
312         }
313     }
314     // printf("sign = %d\n", sign);
315
316     // get hours
317     if ( strlen(time_str) ) {
318         i = 0;
319         while ( (time_str[0] != ':') && (time_str[0] != '\0') ) {
320             num[i] = time_str[0];
321             time_str++;
322             i++;
323         }
324         if ( time_str[0] == ':' ) {
325             time_str++;
326         }
327         num[i] = '\0';
328         hours = atof(num);
329         // printf("hours = %.2lf\n", hours);
330
331         result += hours;
332     }
333
334     // get minutes
335     if ( strlen(time_str) ) {
336         i = 0;
337         while ( (time_str[0] != ':') && (time_str[0] != '\0') ) {
338             num[i] = time_str[0];
339             time_str++;
340             i++;
341         }
342         if ( time_str[0] == ':' ) {
343             time_str++;
344         }
345         num[i] = '\0';
346         minutes = atof(num);
347         // printf("minutes = %.2lf\n", minutes);
348
349         result += minutes / 60.0;
350     }
351
352     // get seconds
353     if ( strlen(time_str) ) {
354         i = 0;
355         while ( (time_str[0] != ':') && (time_str[0] != '\0') ) {
356             num[i] = time_str[0];
357             time_str++;
358             i++;
359         }
360         num[i] = '\0';
361         seconds = atof(num);
362         // printf("seconds = %.2lf\n", seconds);
363
364         result += seconds / 3600.0;
365     }
366
367     return(sign * result);
368 }
369
370
371 long int FGOptions::parse_date( const string& date)
372 {
373     struct tm gmt;
374     char * date_str, num[256];
375     int i;
376     // initialize to zero
377     gmt.tm_sec = 0;
378     gmt.tm_min = 0;
379     gmt.tm_hour = 0;
380     gmt.tm_mday = 0;
381     gmt.tm_mon = 0;
382     gmt.tm_year = 0;
383     gmt.tm_isdst = 0; // ignore daylight savings time for the moment
384     date_str = (char *)date.c_str();
385     // get year
386     if ( strlen(date_str) ) {
387         i = 0;
388         while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
389             num[i] = date_str[0];
390             date_str++;
391             i++;
392         }
393         if ( date_str[0] == ':' ) {
394             date_str++;
395         }
396         num[i] = '\0';
397         gmt.tm_year = atoi(num) - 1900;
398     }
399     // get month
400     if ( strlen(date_str) ) {
401         i = 0;
402         while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
403             num[i] = date_str[0];
404             date_str++;
405             i++;
406         }
407         if ( date_str[0] == ':' ) {
408             date_str++;
409         }
410         num[i] = '\0';
411         gmt.tm_mon = atoi(num) -1;
412     }
413     // get day
414     if ( strlen(date_str) ) {
415         i = 0;
416         while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
417             num[i] = date_str[0];
418             date_str++;
419             i++;
420         }
421         if ( date_str[0] == ':' ) {
422             date_str++;
423         }
424         num[i] = '\0';
425         gmt.tm_mday = atoi(num);
426     }
427     // get hour
428     if ( strlen(date_str) ) {
429         i = 0;
430         while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
431             num[i] = date_str[0];
432             date_str++;
433             i++;
434         }
435         if ( date_str[0] == ':' ) {
436             date_str++;
437         }
438         num[i] = '\0';
439         gmt.tm_hour = atoi(num);
440     }
441     // get minute
442     if ( strlen(date_str) ) {
443         i = 0;
444         while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
445             num[i] = date_str[0];
446             date_str++;
447             i++;
448         }
449         if ( date_str[0] == ':' ) {
450             date_str++;
451         }
452         num[i] = '\0';
453         gmt.tm_min = atoi(num);
454     }
455     // get second
456     if ( strlen(date_str) ) {
457         i = 0;
458         while ( (date_str[0] != ':') && (date_str[0] != '\0') ) {
459             num[i] = date_str[0];
460             date_str++;
461             i++;
462         }
463         if ( date_str[0] == ':' ) {
464             date_str++;
465         }
466         num[i] = '\0';
467         gmt.tm_sec = atoi(num);
468     }
469     time_t theTime = sgTimeGetGMT( gmt.tm_year, gmt.tm_mon, gmt.tm_mday,
470                                    gmt.tm_hour, gmt.tm_min, gmt.tm_sec );
471     //printf ("Date is %s\n", ctime(&theTime));
472     //printf ("in seconds that is %d\n", theTime);
473     //exit(1);
474     return (theTime);
475 }
476
477
478 /// parse degree in the form of [+/-]hhh:mm:ss
479 double
480 FGOptions::parse_degree( const string& degree_str) {
481     double result = parse_time( degree_str );
482
483     // printf("Degree = %.4f\n", result);
484
485     return(result);
486 }
487
488
489 // parse time offset command line option
490 int
491 FGOptions::parse_time_offset( const string& time_str) {
492     int result;
493
494     // printf("time offset = %s\n", time_str);
495
496 #ifdef HAVE_RINT
497     result = (int)rint(parse_time(time_str) * 3600.0);
498 #else
499     result = (int)(parse_time(time_str) * 3600.0);
500 #endif
501
502     // printf("parse_time_offset(): %d\n", result);
503
504     return( result );
505 }
506
507
508 // Parse --fdm=abcdefg type option 
509 int
510 FGOptions::parse_fdm( const string& fm ) const {
511     // cout << "fdm = " << fm << endl;
512
513     if ( fm == "ada" ) {
514         return FGInterface::FG_ADA;
515     } else if ( fm == "balloon" ) {
516         return FGInterface::FG_BALLOONSIM;
517     } else if ( fm == "external" ) {
518         return FGInterface::FG_EXTERNAL;
519     } else if ( fm == "jsb" ) {
520         return FGInterface::FG_JSBSIM;
521     } else if ( (fm == "larcsim") || (fm == "LaRCsim") ) {
522         return FGInterface::FG_LARCSIM;
523     } else if ( fm == "magic" ) {
524         return FGInterface::FG_MAGICCARPET;
525     } else {
526         FG_LOG( FG_GENERAL, FG_ALERT, "Unknown fdm = " << fm );
527         exit(-1);
528     }
529
530     // we'll never get here, but it makes the compiler happy.
531     return -1;
532 }
533
534
535 // Parse --fov=x.xx type option 
536 double
537 FGOptions::parse_fov( const string& arg ) {
538     double fov = atof(arg);
539
540     if ( fov < FG_FOV_MIN ) { fov = FG_FOV_MIN; }
541     if ( fov > FG_FOV_MAX ) { fov = FG_FOV_MAX; }
542
543     globals->get_props()->setDoubleValue("/sim/field-of-view", fov);
544
545     // printf("parse_fov(): result = %.4f\n", fov);
546
547     return fov;
548 }
549
550
551 // Parse I/O channel option
552 //
553 // Format is "--protocol=medium,direction,hz,medium_options,..."
554 //
555 //   protocol = { native, nmea, garmin, fgfs, rul, pve, etc. }
556 //   medium = { serial, socket, file, etc. }
557 //   direction = { in, out, bi }
558 //   hz = number of times to process channel per second (floating
559 //        point values are ok.
560 //
561 // Serial example "--nmea=serial,dir,hz,device,baud" where
562 // 
563 //  device = OS device name of serial line to be open()'ed
564 //  baud = {300, 1200, 2400, ..., 230400}
565 //
566 // Socket exacmple "--native=socket,dir,hz,machine,port,style" where
567 // 
568 //  machine = machine name or ip address if client (leave empty if server)
569 //  port = port, leave empty to let system choose
570 //  style = tcp or udp
571 //
572 // File example "--garmin=file,dir,hz,filename" where
573 // 
574 //  filename = file system file name
575
576 bool 
577 FGOptions::parse_channel( const string& type, const string& channel_str ) {
578     // cout << "Channel string = " << channel_str << endl;
579
580     globals->get_channel_options_list().push_back( type + "," + channel_str );
581
582     return true;
583 }
584
585
586 // Parse --wp=ID[,alt]
587 bool FGOptions::parse_wp( const string& arg ) {
588     string id, alt_str;
589     double alt = 0.0;
590
591     int pos = arg.find( "@" );
592     if ( pos != string::npos ) {
593         id = arg.substr( 0, pos );
594         alt_str = arg.substr( pos + 1 );
595         // cout << "id str = " << id << "  alt str = " << alt_str << endl;
596         alt = atof( alt_str.c_str() );
597         if ( globals->get_props()->getStringValue("/sim/startup/units")
598              == "feet" ) {
599             alt *= FEET_TO_METER;
600         }
601     } else {
602         id = arg;
603     }
604
605     FGAirport a;
606     if ( fgFindAirportID( id, &a ) ) {
607         SGWayPoint wp( a.longitude, a.latitude, alt, SGWayPoint::WGS84, id );
608         globals->get_route()->add_waypoint( wp );
609
610         return true;
611     } else {
612         return false;
613     }
614 }
615
616
617 // Parse --flight-plan=[file]
618 bool FGOptions::parse_flightplan(const string& arg)
619 {
620     fg_gzifstream infile(arg.c_str());
621     if (!infile) {
622         return false;
623     }
624     while ( true ) {
625         string line;
626 #ifdef GETLINE_NEEDS_TERMINATOR
627         getline( infile, line, '\n' );
628 #elif defined( macintosh )
629         getline( infile, line, '\r' );
630 #else
631         getline( infile, line );
632 #endif
633         if ( infile.eof() ) {
634             break;
635         }
636         parse_wp(line);
637     }
638
639     return true;
640 }
641
642
643 // Parse a single option
644 int FGOptions::parse_option( const string& arg ) {
645     SGPropertyNode * props = globals->get_props();
646     // General Options
647     if ( (arg == "--help") || (arg == "-h") ) {
648         // help/usage request
649         return(FG_OPTIONS_HELP);
650     } else if ( arg == "--disable-game-mode") {
651         props->setBoolValue("/sim/startup/game-mode", false);
652     } else if ( arg == "--enable-game-mode" ) {
653         props->setBoolValue("/sim/startup/game-mode", true);
654     } else if ( arg == "--disable-splash-screen" ) {
655         props->setBoolValue("/sim/startup/splash-screen", false); 
656     } else if ( arg == "--enable-splash-screen" ) {
657         props->setBoolValue("/sim/startup/splash-screen", true);
658     } else if ( arg == "--disable-intro-music" ) {
659         props->setBoolValue("/sim/startup/intro-music", false);
660     } else if ( arg == "--enable-intro-music" ) {
661         props->setBoolValue("/sim/startup/intro-music", true);
662     } else if ( arg == "--disable-mouse-pointer" ) {
663         props->setStringValue("/sim/startup/mouse-pointer", "disabled");
664     } else if ( arg == "--enable-mouse-pointer" ) {
665         props->setStringValue("/sim/startup/mouse-pointer", "enabled");
666     } else if ( arg == "--disable-freeze" ) {
667         props->setBoolValue("/sim/freeze", false);
668     } else if ( arg == "--enable-freeze" ) {
669         props->setBoolValue("/sim/freeze", true);
670     } else if ( arg == "--disable-anti-alias-hud" ) {
671         props->setBoolValue("/sim/hud/antialiased", false);
672     } else if ( arg == "--enable-anti-alias-hud" ) {
673         props->setBoolValue("/sim/hud/antialiased", true);
674     } else if ( arg.find( "--control=") != string::npos ) {
675         props->setStringValue("/sim/control-mode", arg.substr(10));
676     } else if ( arg == "--disable-auto-coordination" ) {
677         props->setBoolValue("/sim/auto-coordination", false);
678     } else if ( arg == "--enable-auto-coordination" ) {
679         props->setBoolValue("/sim/auto-coordination", true);
680     } else if ( arg == "--disable-hud" ) {
681         props->setBoolValue("/sim/hud/visibility", false);
682     } else if ( arg == "--enable-hud" ) {
683         props->setBoolValue("/sim/hud/visibility", true);
684     } else if ( arg == "--disable-panel" ) {
685         props->setBoolValue("/sim/panel/visibility", false);
686     } else if ( arg == "--enable-panel" ) {
687         props->setBoolValue("/sim/panel/visibility", true);
688     } else if ( arg == "--disable-sound" ) {
689         props->setBoolValue("/sim/sound", false);
690     } else if ( arg == "--enable-sound" ) {
691         props->setBoolValue("/sim/sound", true);
692     } else if ( arg.find( "--airport-id=") != string::npos ) {
693                                 // NB: changed property name!!!
694         props->setStringValue("/sim/startup/airport-id", arg.substr(13));
695     } else if ( arg.find( "--lon=" ) != string::npos ) {
696         props->setDoubleValue("/position/longitude",
697                               parse_degree(arg.substr(6)));
698         props->setStringValue("/position/airport-id", "");
699     } else if ( arg.find( "--lat=" ) != string::npos ) {
700         props->setDoubleValue("/position/latitude",
701                               parse_degree(arg.substr(6)));
702         props->setStringValue("/position/airport-id", "");
703     } else if ( arg.find( "--altitude=" ) != string::npos ) {
704         if ( props->getStringValue("/sim/startup/units") == "feet" )
705             props->setDoubleValue(atof(arg.substr(11)));
706         else
707             props->setDoubleValue(atof(arg.substr(11)) * METER_TO_FEET);
708     } else if ( arg.find( "--uBody=" ) != string::npos ) {
709         props->setStringValue("/sim/startup/speed-set", "UVW");
710                                 // FIXME: the units are totally confused here
711         if ( props->getStringValue("/sim/startup/units") == "feet" )
712           props->setDoubleValue("/velocities/uBody", atof(arg.substr(8)));
713         else
714           props->setDoubleValue("/velocities/uBody",
715                                atof(arg.substr(8)) * FEET_TO_METER);
716     } else if ( arg.find( "--vBody=" ) != string::npos ) {
717         props->setStringValue("/sim/startup/speed-set", "UVW");
718                                 // FIXME: the units are totally confused here
719         if ( props->getStringValue("/sim/startup/units") == "feet" )
720           props->setDoubleValue("/velocities/vBody", atof(arg.substr(8)));
721         else
722           props->setDoubleValue("/velocities/vBody",
723                                atof(arg.substr(8)) * FEET_TO_METER);
724     } else if ( arg.find( "--wBody=" ) != string::npos ) {
725         props->setStringValue("/sim/startup/speed-set", "UVW");
726                                 // FIXME: the units are totally confused here
727         if ( props->getStringValue("/sim/startup/units") == "feet" )
728           props->setDoubleValue("/velocities/wBody", atof(arg.substr(8)));
729         else
730           props->setDoubleValue("/velocities/wBody",
731                                atof(arg.substr(8)) * FEET_TO_METER);
732     } else if ( arg.find( "--vNorth=" ) != string::npos ) {
733         props->setStringValue("/sim/startup/speed-set", "NED");
734                                 // FIXME: the units are totally confused here
735         if ( props->getStringValue("/sim/startup/units") == "feet" )
736           props->setDoubleValue("/velocities/speed-north", atof(arg.substr(8)));
737         else
738           props->setDoubleValue("/velocities/speed-north",
739                                atof(arg.substr(8)) * FEET_TO_METER);
740     } else if ( arg.find( "--vEast=" ) != string::npos ) {
741         props->setStringValue("/sim/startup/speed-set", "NED");
742                                 // FIXME: the units are totally confused here
743         if ( props->getStringValue("/sim/startup/units") == "feet" )
744           props->setDoubleValue("/velocities/speed-east", atof(arg.substr(8)));
745         else
746           props->setDoubleValue("/velocities/speed-east",
747                                atof(arg.substr(8)) * FEET_TO_METER);
748     } else if ( arg.find( "--vDown=" ) != string::npos ) {
749         props->setStringValue("/sim/startup/speed-set", "NED");
750                                 // FIXME: the units are totally confused here
751         if ( props->getStringValue("/sim/startup/units") == "feet" )
752           props->setDoubleValue("/velocities/speed-down", atof(arg.substr(8)));
753         else
754           props->setDoubleValue("/velocities/speed-down",
755                                atof(arg.substr(8)) * FEET_TO_METER);
756     } else if ( arg.find( "--vc=" ) != string::npos) {
757         props->setStringValue("/sim/startup/speed-set", "knots");
758         props->setDoubleValue("/velocities/airspeed", atof(arg.substr(5)));
759     } else if ( arg.find( "--mach=" ) != string::npos) {
760         props->setStringValue("/sim/startup/speed-set", "mach");
761         props->setDoubleValue("/velocities/mach", atof(arg.substr(7)));
762     } else if ( arg.find( "--heading=" ) != string::npos ) {
763         props->setDoubleValue("/orientation/heading", atof(arg.substr(10)));
764     } else if ( arg.find( "--roll=" ) != string::npos ) {
765         props->setDoubleValue("/orientation/roll", atof(arg.substr(7)));
766     } else if ( arg.find( "--pitch=" ) != string::npos ) {
767         props->setDoubleValue("/orientation/pitch", atof(arg.substr(8)));
768     } else if ( arg.find( "--fg-root=" ) != string::npos ) {
769         globals->set_fg_root(arg.substr( 10 ));
770     } else if ( arg.find( "--fg-scenery=" ) != string::npos ) {
771         globals->set_fg_scenery(arg.substr( 13 ));
772     } else if ( arg.find( "--fdm=" ) != string::npos ) {
773         props->setStringValue("/sim/flight-model", arg.substr(6));
774                                 // FIXME: reimplement this logic, somehow
775 //     if((flight_model == FGInterface::FG_JSBSIM) && (get_trim_mode() == 0)) {
776 //         props->
777 //      set_trim_mode(1);
778 //     } else {
779 //      set_trim_mode(0);
780 //     }        
781     } else if ( arg.find( "--aircraft=" ) != string::npos ) {
782         props->setStringValue("/sim/aircraft", arg.substr(11));
783     } else if ( arg.find( "--aircraft-dir=" ) != string::npos ) {
784         props->setStringValue("/sim/aircraft-dir", arg.substr(15));
785     } else if ( arg.find( "--model-hz=" ) != string::npos ) {
786         props->setIntValue("/sim/model-hz", atoi(arg.substr(11)));
787     } else if ( arg.find( "--speed=" ) != string::npos ) {
788         props->setIntValue("/sim/speed-up", atoi(arg.substr(8)));
789     } else if ( arg.find( "--notrim") != string::npos) {
790         props->setIntValue("/sim/startup/trim", -1);
791     } else if ( arg == "--fog-disable" ) {
792         props->setStringValue("/sim/rendering/fog", "disabled");
793     } else if ( arg == "--fog-fastest" ) {
794         props->setStringValue("/sim/rendering/fog", "fastest");
795     } else if ( arg == "--fog-nicest" ) {
796         props->setStringValue("/sim/fog", "nicest");
797     } else if ( arg == "--disable-clouds" ) {
798         props->setBoolValue("/environment/clouds/enabled", false);
799     } else if ( arg == "--enable-clouds" ) {
800         props->setBoolValue("/environment/clouds/enabled", true);
801     } else if ( arg.find( "--clouds-asl=" ) != string::npos ) {
802                                 // FIXME: check units
803         if ( props->getStringValue("/sim/startup/units") == "feet" )
804           props->setDoubleValue("/environment/clouds/altitude",
805                                 atof(arg.substr(13)) * FEET_TO_METER);
806         else
807           props->setDoubleValue("/environment/clouds/altitude",
808                                 atof(arg.substr(13)));
809     } else if ( arg.find( "--fov=" ) != string::npos ) {
810         parse_fov( arg.substr(6) );
811     } else if ( arg == "--disable-fullscreen" ) {
812         props->setBoolValue("/sim/startup/fullscreen", false);
813     } else if ( arg== "--enable-fullscreen") {
814         props->setBoolValue("/sim/startup/fullscreen", true);
815     } else if ( arg == "--shading-flat") {
816         props->setBoolValue("/sim/rendering/shading", false);
817     } else if ( arg == "--shading-smooth") {
818         props->setBoolValue("/sim/rendering/shading", true);
819     } else if ( arg == "--disable-skyblend") {
820         props->setBoolValue("/sim/rendering/skyblend", false);
821     } else if ( arg== "--enable-skyblend" ) {
822         props->setBoolValue("/sim/rendering/skyblend", true);
823     } else if ( arg == "--disable-textures" ) {
824         props->setBoolValue("/sim/rendering/textures", false);
825     } else if ( arg == "--enable-textures" ) {
826         props->setBoolValue("/sim/rendering/textures", true);
827     } else if ( arg == "--disable-wireframe" ) {
828         props->setBoolValue("/sim/rendering/wireframe", false);
829     } else if ( arg == "--enable-wireframe" ) {
830         props->setBoolValue("/sim/rendering/wireframe", true);
831     } else if ( arg.find( "--geometry=" ) != string::npos ) {
832         bool geometry_ok = true;
833         int xsize = 0, ysize = 0;
834         string geometry = arg.substr( 11 );
835         string::size_type i = geometry.find('x');
836
837         if (i != string::npos) {
838             xsize = atoi(geometry.substr(0, i));
839             ysize = atoi(geometry.substr(i+1));
840         } else {
841             geometry_ok = false;
842         }
843
844         if ( xsize <= 0 || ysize <= 0 ) {
845             xsize = 640;
846             ysize = 480;
847             geometry_ok = false;
848         }
849
850         if ( !geometry_ok ) {
851             FG_LOG( FG_GENERAL, FG_ALERT, "Unknown geometry: " << geometry );
852             FG_LOG( FG_GENERAL, FG_ALERT,
853                     "Setting geometry to " << xsize << 'x' << ysize << '\n');
854         } else {
855           FG_LOG( FG_GENERAL, FG_INFO,
856                   "Setting geometry to " << xsize << 'x' << ysize << '\n');
857           props->setIntValue("/sim/startup/xsize", xsize);
858           props->setIntValue("/sim/startup/ysize", ysize);
859         }
860     } else if ( arg.find( "--bpp=" ) != string::npos ) {
861         string bits_per_pix = arg.substr( 6 );
862         if ( bits_per_pix == "16" ) {
863             props->setIntValue("/sim/rendering/bits-per-pixel", 16);
864         } else if ( bits_per_pix == "24" ) {
865             props->setIntValue("/sim/rendering/bits-per-pixel", 24);
866         } else if ( bits_per_pix == "32" ) {
867             props->setIntValue("/sim/rendering/bits-per-pixel", 32);
868         } else {
869           FG_LOG(FG_GENERAL, FG_ALERT, "Unsupported bpp " << bits_per_pix);
870         }
871     } else if ( arg == "--units-feet" ) {
872         props->setStringValue("/sim/startup/units", "feet");
873     } else if ( arg == "--units-meters" ) {
874         props->setStringValue("/sim/startup/units", "meters");
875     } else if ( arg.find( "--time-offset" ) != string::npos ) {
876         props->setIntValue("/sim/startup/time-offset",
877                            parse_time_offset( (arg.substr(14)) ));
878     } else if ( arg.find( "--time-match-real") != string::npos ) {
879         props->setStringValue("/sim/startup/time-offset_type",
880                               "system-offset");
881     } else if ( arg.find( "--time-match-local") != string::npos ) {
882         props->setStringValue("/sim/startup/time-offset_type",
883                               "latitude-offset");
884     } else if ( arg.find( "--start-date-sys=") != string::npos ) {
885         props->setIntValue("/sim/startup/time-offset",
886                            parse_date((arg.substr(17))));
887         props->setStringValue("/sim/startup/time-offset-type", "system");
888     } else if ( arg.find( "--start-date-lat=") != string::npos ) {
889         props->setIntValue("/sim/startup/time-offset",
890                            parse_date((arg.substr(17))));
891         props->setStringValue("/sim/startup/time-offset-type",
892                            "latitude");
893     } else if ( arg.find( "--start-date-gmt=") != string::npos ) {
894         props->setIntValue("/sim/startup/time-offset",
895                            parse_date((arg.substr(17))));
896         props->setStringValue("/sim/startup/time-offset-type", "gmt");
897     } else if ( arg == "--hud-tris" ) {
898         props->setStringValue("/sim/hud/frame-stat-type", "tris");
899     } else if ( arg == "--hud-culled" ) {
900         props->setStringValue("/sim/hud/frame-stat-type", "culled");
901     } else if ( arg.find( "--native=" ) != string::npos ) {
902         parse_channel( "native", arg.substr(9) );
903     } else if ( arg.find( "--garmin=" ) != string::npos ) {
904         parse_channel( "garmin", arg.substr(9) );
905     } else if ( arg.find( "--nmea=" ) != string::npos ) {
906         parse_channel( "nmea", arg.substr(7) );
907     } else if ( arg.find( "--props=" ) != string::npos ) {
908         parse_channel( "props", arg.substr(8) );
909     } else if ( arg.find( "--pve=" ) != string::npos ) {
910         parse_channel( "pve", arg.substr(6) );
911     } else if ( arg.find( "--ray=" ) != string::npos ) {
912         parse_channel( "ray", arg.substr(6) );
913     } else if ( arg.find( "--rul=" ) != string::npos ) {
914         parse_channel( "rul", arg.substr(6) );
915     } else if ( arg.find( "--joyclient=" ) != string::npos ) {
916         parse_channel( "joyclient", arg.substr(12) );
917 #ifdef FG_NETWORK_OLK
918     } else if ( arg == "--disable-network-olk" ) {
919         props->setBoolValue("/sim/networking/olk", false);
920     } else if ( arg== "--enable-network-olk") {
921         props->setBoolValue("/sim/networking/olk", true);
922     } else if ( arg == "--net-hud" ) {
923         props->setBoolValue("/sim/hud/net-display", true);
924         net_hud_display = 1;    // FIXME
925     } else if ( arg.find( "--net-id=") != string::npos ) {
926         props->setStringValue("sim/networking/call-sign", arg.substr(9));
927 #endif
928     } else if ( arg.find( "--prop:" ) == 0 ) {
929         string assign = arg.substr(7);
930         int pos = assign.find('=');
931         if (pos == arg.npos || pos == 0) {
932             FG_LOG(FG_GENERAL, FG_ALERT, "Bad property assignment: " << arg);
933             return FG_OPTIONS_ERROR;
934         }
935         string name = assign.substr(0, pos);
936         string value = assign.substr(pos + 1);
937         props->setStringValue(name.c_str(), value);
938         FG_LOG(FG_GENERAL, FG_INFO, "Setting default value of property "
939                << name << " to \"" << value << '"');
940     // $$$ begin - added VS Renganathan, 14 Oct 2K
941     // for multi-window outside window imagery
942     } else if ( arg.find( "--view-offset=" ) != string::npos ) {
943         string woffset = arg.substr( 14 );
944         double default_view_offset = 0.0;
945         if ( woffset == "LEFT" ) {
946                default_view_offset = FG_PI * 0.25;
947         } else if ( woffset == "RIGHT" ) {
948             default_view_offset = FG_PI * 1.75;
949         } else if ( woffset == "CENTER" ) {
950             default_view_offset = 0.00;
951         } else {
952             default_view_offset = atof( woffset.c_str() ) * DEG_TO_RAD;
953         }
954         FGViewerRPH *pilot_view =
955             (FGViewerRPH *)globals->get_viewmgr()->get_view( 0 );
956         pilot_view->set_view_offset( default_view_offset );
957         pilot_view->set_goal_view_offset( default_view_offset );
958         props->setDoubleValue("/sim/startup/view-offset", default_view_offset);
959     // $$$ end - added VS Renganathan, 14 Oct 2K
960     } else if ( arg.find( "--visibility=" ) != string::npos ) {
961         props->setDoubleValue("/environment/visibility", atof(arg.substr(13)));
962     } else if ( arg.find( "--visibility-miles=" ) != string::npos ) {
963         double visibility = atof(arg.substr(19)) * 5280.0 * FEET_TO_METER;
964         props->setDoubleValue("/environment/visibility", visibility);
965     } else if ( arg.find( "--wind=" ) == 0 ) {
966         string val = arg.substr(7);
967         int pos = val.find('@');
968         if (pos == string::npos) {
969           FG_LOG(FG_GENERAL, FG_ALERT, "bad wind value " << val);
970           return FG_OPTIONS_ERROR;
971         }
972         double dir = atof(val.substr(0,pos).c_str());
973         double speed = atof(val.substr(pos+1).c_str());
974         FG_LOG(FG_GENERAL, FG_INFO, "WIND: " << dir << '@' << 
975                speed << " knots" << endl);
976                                 // convert to fps
977         speed *= NM_TO_METER * METER_TO_FEET * (1.0/3600);
978         dir += 180;
979         if (dir >= 360)
980           dir -= 360;
981         dir *= DEG_TO_RAD;
982         props->setDoubleValue("/environment/wind-north",
983                                              speed * cos(dir));
984         props->setDoubleValue("/environment/wind-east",
985                                              speed * sin(dir));
986     } else if ( arg.find( "--wp=" ) != string::npos ) {
987         parse_wp( arg.substr( 5 ) );
988     } else if ( arg.find( "--flight-plan=") != string::npos) {
989         parse_flightplan ( arg.substr (14) );
990     } else {
991         FG_LOG( FG_GENERAL, FG_ALERT, "Unknown option '" << arg << "'" );
992         return FG_OPTIONS_ERROR;
993     }
994     
995     return FG_OPTIONS_OK;
996 }
997
998
999 // Scan the command line options for an fg_root definition and set
1000 // just that.
1001 int FGOptions::scan_command_line_for_root( int argc, char **argv ) {
1002     int i = 1;
1003
1004     FG_LOG(FG_GENERAL, FG_INFO, "Processing command line arguments");
1005
1006     while ( i < argc ) {
1007         FG_LOG( FG_GENERAL, FG_DEBUG, "argv[" << i << "] = " << argv[i] );
1008
1009         string arg = argv[i];
1010         if ( arg.find( "--fg-root=" ) != string::npos ) {
1011             globals->set_fg_root(arg.substr( 10 ));
1012         }
1013
1014         i++;
1015     }
1016     
1017     return FG_OPTIONS_OK;
1018 }
1019
1020
1021 // Scan the config file for an fg_root definition and set just that.
1022 int FGOptions::scan_config_file_for_root( const string& path ) {
1023     fg_gzifstream in( path );
1024     if ( !in.is_open() )
1025         return(FG_OPTIONS_ERROR);
1026
1027     FG_LOG( FG_GENERAL, FG_INFO, "Scanning for root: " << path );
1028
1029     in >> skipcomment;
1030 #ifndef __MWERKS__
1031     while ( ! in.eof() ) {
1032 #else
1033     char c = '\0';
1034     while ( in.get(c) && c != '\0' ) {
1035         in.putback(c);
1036 #endif
1037         string line;
1038
1039 #ifdef GETLINE_NEEDS_TERMINATOR
1040         getline( in, line, '\n' );
1041 #elif defined( macintosh )
1042         getline( in, line, '\r' );
1043 #else
1044         getline( in, line );
1045 #endif
1046
1047         if ( line.find( "--fg-root=" ) != string::npos ) {
1048             globals->set_fg_root(line.substr( 10 ));
1049         }
1050
1051         in >> skipcomment;
1052     }
1053
1054     return FG_OPTIONS_OK;
1055 }
1056
1057
1058 // Parse the command line options
1059 int FGOptions::parse_command_line( int argc, char **argv ) {
1060     int i = 1;
1061     int result;
1062
1063     FG_LOG(FG_GENERAL, FG_INFO, "Processing command line arguments");
1064
1065     while ( i < argc ) {
1066         FG_LOG( FG_GENERAL, FG_DEBUG, "argv[" << i << "] = " << argv[i] );
1067
1068         result = parse_option(argv[i]);
1069         if ( (result == FG_OPTIONS_HELP) || (result == FG_OPTIONS_ERROR) ) {
1070             return(result);
1071         }
1072
1073         i++;
1074     }
1075     
1076     return FG_OPTIONS_OK;
1077 }
1078
1079
1080 // Parse config file options
1081 int FGOptions::parse_config_file( const string& path ) {
1082     fg_gzifstream in( path );
1083     if ( !in.is_open() )
1084         return(FG_OPTIONS_ERROR);
1085
1086     FG_LOG( FG_GENERAL, FG_INFO, "Processing config file: " << path );
1087
1088     in >> skipcomment;
1089 #ifndef __MWERKS__
1090     while ( ! in.eof() ) {
1091 #else
1092     char c = '\0';
1093     while ( in.get(c) && c != '\0' ) {
1094         in.putback(c);
1095 #endif
1096         string line;
1097
1098 #ifdef GETLINE_NEEDS_TERMINATOR
1099         getline( in, line, '\n' );
1100 #elif defined( macintosh )
1101         getline( in, line, '\r' );
1102 #else
1103         getline( in, line );
1104 #endif
1105
1106         if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
1107             FG_LOG( FG_GENERAL, FG_ALERT, 
1108                     "Config file parse error: " << path << " '" 
1109                     << line << "'" );
1110             exit(-1);
1111         }
1112         in >> skipcomment;
1113     }
1114
1115     return FG_OPTIONS_OK;
1116 }
1117
1118
1119 // Print usage message
1120 void FGOptions::usage ( void ) {
1121     cout << "Usage: fg [ options ... ]" << endl;
1122     cout << endl;
1123
1124     cout << "General Options:" << endl;
1125     cout << "\t--help -h:  print usage" << endl;
1126     cout << "\t--fg-root=path:  specify the root path for all the data files"
1127          << endl;
1128     cout << "\t--fg-scenery=path:  specify the base path for all the scenery"
1129          << " data." << endl
1130          << "\t\tdefaults to $FG_ROOT/Scenery" << endl;
1131     cout << "\t--disable-game-mode:  disable full-screen game mode" << endl;
1132     cout << "\t--enable-game-mode:  enable full-screen game mode" << endl;
1133     cout << "\t--disable-splash-screen:  disable splash screen" << endl;
1134     cout << "\t--enable-splash-screen:  enable splash screen" << endl;
1135     cout << "\t--disable-intro-music:  disable introduction music" << endl;
1136     cout << "\t--enable-intro-music:  enable introduction music" << endl;
1137     cout << "\t--disable-mouse-pointer:  disable extra mouse pointer" << endl;
1138     cout << "\t--enable-mouse-pointer:  enable extra mouse pointer (i.e. for"
1139          << endl;
1140     cout << "\t\tfull screen voodoo/voodoo-II based cards.)" << endl;
1141     cout << "\t--disable-freeze:  start out in an running state" << endl;
1142     cout << "\t--enable-freeze:  start out in a frozen state" << endl;
1143     cout << "\t--control=mode:  primary control mode " 
1144          << "(joystick, keyboard, mouse)" << endl;
1145     cout << endl;
1146
1147     cout << "Features:" << endl;
1148     cout << "\t--disable-hud:  disable heads up display" << endl;
1149     cout << "\t--enable-hud:  enable heads up display" << endl;
1150     cout << "\t--disable-panel:  disable instrument panel" << endl;
1151     cout << "\t--enable-panel:  enable instrumetn panel" << endl;
1152     cout << "\t--disable-sound:  disable sound effects" << endl;
1153     cout << "\t--enable-sound:  enable sound effects" << endl;
1154     cout << "\t--disable-anti-alias-hud:  disable anti aliased hud" << endl;
1155     cout << "\t--enable-anti-alias-hud:  enable anti aliased hud" << endl;
1156     cout << endl;
1157  
1158     cout << "Flight Model:" << endl;
1159     cout << "\t--fdm=abcd:  selects the core flight model code." << endl;
1160     cout << "\t\tcan be one of jsb, larcsim, magic, external, balloon, or ada"
1161          << endl;
1162     cout << "\t--aircraft=abcd:  aircraft model to load" << endl;
1163     cout << "\t--model-hz=n:  run the FDM this rate (iterations per second)" 
1164          << endl;
1165     cout << "\t--speed=n:  run the FDM this much faster than real time" << endl;
1166     cout << "\t--notrim:  Do NOT attempt to trim the model when initializing JSBsim" << endl;
1167     cout << "\t--wind=DIR@SPEED: specify wind coming from DIR (degrees) at SPEED (knots)" << endl;
1168     cout << endl;
1169
1170     //(UIUC)
1171     cout <<"Aircraft model directory:" << endl;
1172     cout <<"\t--aircraft-dir=<path> path is relative to the path of the executable" << endl;
1173     cout << endl;
1174
1175     cout << "Initial Position and Orientation:" << endl;
1176     cout << "\t--airport-id=ABCD:  specify starting postion by airport id" 
1177          << endl;
1178     cout << "\t--lon=degrees:  starting longitude in degrees (west = -)" 
1179          << endl;
1180     cout << "\t--lat=degrees:  starting latitude in degrees (south = -)"
1181          << endl;
1182     cout << "\t--altitude=feet:  starting altitude in feet" << endl;
1183     cout << "\t\t(unless --units-meters specified" << endl;
1184     cout << "\t--heading=degrees:  heading (yaw) angle in degress (Psi)"
1185          << endl;
1186     cout << "\t--roll=degrees:  roll angle in degrees (Phi)" << endl;
1187     cout << "\t--pitch=degrees:  pitch angle in degrees (Theta)" << endl;
1188     cout << "\t--uBody=feet per second:  velocity along the body X axis"
1189          << endl;
1190     cout << "\t--vBody=feet per second:  velocity along the body Y axis"
1191          << endl;
1192     cout << "\t--wBody=feet per second:  velocity along the body Z axis"
1193          << endl;
1194     cout << "\t\t(unless --units-meters specified" << endl;
1195     cout << "\t--vc= initial airspeed in knots (--fdm=jsb only)" << endl;
1196     cout << "\t--mach= initial mach number (--fdm=jsb only)" << endl;
1197     cout << endl;
1198
1199     cout << "Rendering Options:" << endl;
1200     cout << "\t--fog-disable:  disable fog/haze" << endl;
1201     cout << "\t--fog-fastest:  enable fastest fog/haze" << endl;
1202     cout << "\t--fog-nicest:  enable nicest fog/haze" << endl;
1203     cout << "\t--enable-clouds:  enable demo cloud layer" << endl;
1204     cout << "\t--disable-clouds:  disable demo cloud layer" << endl;
1205     cout << "\t--clouds-asl=xxx:  specify altitude of cloud layer above sea level" << endl;
1206     cout << "\t--fov=xx.x:  specify initial field of view angle in degrees"
1207          << endl;
1208     cout << "\t--disable-fullscreen:  disable fullscreen mode" << endl;
1209     cout << "\t--enable-fullscreen:  enable fullscreen mode" << endl;
1210     cout << "\t--shading-flat:  enable flat shading" << endl;
1211     cout << "\t--shading-smooth:  enable smooth shading" << endl;
1212     cout << "\t--disable-skyblend:  disable sky blending" << endl;
1213     cout << "\t--enable-skyblend:  enable sky blending" << endl;
1214     cout << "\t--disable-textures:  disable textures" << endl;
1215     cout << "\t--enable-textures:  enable textures" << endl;
1216     cout << "\t--disable-wireframe:  disable wireframe drawing mode" << endl;
1217     cout << "\t--enable-wireframe:  enable wireframe drawing mode" << endl;
1218     cout << "\t--geometry=WWWxHHH:  window geometry: 640x480, 800x600, etc."
1219          << endl;
1220     cout << "\t--view-offset=xxx:  set the default forward view direction"
1221          << endl;
1222     cout << "\t\tas an offset from straight ahead.  Allowable values are"
1223          << endl;
1224     cout << "\t\tLEFT, RIGHT, CENTER, or a specific number of degrees" << endl;
1225     cout << "\t--visibility=xxx:  specify initial visibility in meters" << endl;
1226     cout << "\t--visibility-miles=xxx:  specify initial visibility in miles"
1227          << endl;
1228     cout << endl;
1229
1230     cout << "Scenery Options:" << endl;
1231     cout << "\t--tile-radius=n:  specify tile radius, must be 1 - 4" << endl;
1232     cout << endl;
1233
1234     cout << "Hud Options:" << endl;
1235     cout << "\t--units-feet:  Hud displays units in feet" << endl;
1236     cout << "\t--units-meters:  Hud displays units in meters" << endl;
1237     cout << "\t--hud-tris:  Hud displays number of triangles rendered" << endl;
1238     cout << "\t--hud-culled:  Hud displays percentage of triangles culled"
1239          << endl;
1240     cout << endl;
1241         
1242     cout << "Time Options:" << endl;
1243     cout << "\t--time-offset=[+-]hh:mm:ss: add this time offset" << endl;
1244     cout << "\t--time-match-real: Synchronize real-world and FlightGear" << endl
1245          << "\t\ttime. Can be used in combination with --time-offset." << endl;
1246     cout << "\t--time-match-local:Synchronize local real-world and " << endl
1247          << "\t\tFlightGear time" << endl;   
1248     cout << "\t--start-date-sys=yyyy:mm:dd:hh:mm:ss: specify a starting" << endl
1249          << "\t\tdate/time. Uses your system time " << endl;
1250     cout << "\t--start-date-gmt=yyyy:mm:dd:hh:mm:ss: specify a starting" << endl
1251          << "\t\tdate/time. Uses Greenwich Mean Time" << endl;
1252     cout << "\t--start-date-lat=yyyy:mm:dd:hh:mm:ss: specify a starting" << endl
1253          << "\t\tdate/time. Uses Local Aircraft Time" << endl;
1254 #ifdef FG_NETWORK_OLK
1255     cout << endl;
1256
1257     cout << "Network Options:" << endl;
1258     cout << "\t--enable-network-olk:  enable Multipilot mode" << endl;
1259     cout << "\t--disable-network-olk:  disable Multipilot mode (default)" << endl;
1260     cout << "\t--net-hud:  Hud displays network info" << endl;
1261     cout << "\t--net-id=name:  specify your own callsign" << endl;
1262 #endif
1263
1264     cout << endl;
1265     cout << "Route/Way Point Options:" << endl;
1266     cout << "\t--wp=ID[@alt]:  specify a waypoint for the GC autopilot" << endl;
1267     cout << "\t\tYou can specify multiple waypoints (a route) with multiple"
1268          << endl;
1269     cout << "\t\tinstances of --wp=" << endl;
1270     cout << "\t--flight-plan=[file]: Read all waypoints from [file]" <<endl;
1271 }
1272
1273
1274 // Destructor
1275 FGOptions::~FGOptions( void ) {
1276 }
1277
1278
1279 //
1280 // Temporary methods...
1281 //
1282
1283 string
1284 FGOptions::get_fg_root() const
1285 {
1286   return globals->get_fg_root();
1287 }
1288
1289 string
1290 FGOptions::get_fg_scenery () const
1291 {
1292   return globals->get_fg_scenery();
1293 }
1294
1295 string_list
1296 FGOptions::get_channel_options_list () const
1297 {
1298   return globals->get_channel_options_list();
1299 }