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