-//
// options.hxx -- class to handle command line options
//
// Written by Curtis Olson, started April 1998.
# include <config.h>
#endif
+#include <Include/compiler.h>
+
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <GL/glut.h>
#include <XGL/xgl.h>
-#include <string>
+#include STL_STRING
+FG_USING_STD(string);
+
+#include <vector>
+#include "Include/compiler.h"
+FG_USING_STD(vector);
+FG_USING_STD(string);
+// #include "fg_serial.hxx"
+
+
+typedef vector < string > str_container;
+typedef str_container::iterator str_iterator;
+typedef str_container::const_iterator const_str_iterator;
-#ifdef NEEDNAMESPACESTD
-using namespace std;
-#endif
class fgOPTIONS {
+
public:
+
enum
{
FG_OPTIONS_OK = 0,
FG_OPTIONS_ERROR = 2
};
+ enum
+ {
+ FG_UNITS_FEET = 0,
+ FG_UNITS_METERS = 1
+ };
+
enum fgFogKind
{
FG_FOG_DISABLED = 0,
FG_FOG_NICEST = 2
};
- static const int FG_RADIUS_MIN = 1;
- static const int FG_RADIUS_MAX = 4;
+ enum
+ {
+ FG_RADIUS_MIN = 1,
+ FG_RADIUS_MAX = 4
+ };
private:
bool skyblend; // Blend sky to haze (using polygons) or just clear
bool textures; // Textures enabled/disabled
bool wireframe; // Wireframe mode enabled/disabled
+ int xsize, ysize; // window size derived from geometry string
// Scenery options
int tile_radius; // Square radius of rendered tiles (around center
// further away.
// HUD options
+ int units; // feet or meters
int tris_or_culled;
// Time options
int time_offset; // Offset true time by this many seconds
+ // Serial Ports, we currently support up to four channels
+ // fgSerialPortKind port_a_kind; // Port a kind
+ // fgSerialPortKind port_b_kind; // Port b kind
+ // fgSerialPortKind port_c_kind; // Port c kind
+ // fgSerialPortKind port_d_kind; // Port d kind
+
+ // Serial port configuration strings
+ str_container port_options_list;
+
public:
fgOPTIONS();
void usage ( void );
// Query functions
- string get_fg_root() const { return fg_root; }
- string get_airport_id() const { return airport_id; }
- double get_lon() const { return lon; }
- double get_lat() const { return lat; }
- double get_altitude() const { return altitude; }
- double get_heading() const { return heading; }
- double get_roll() const { return roll; }
- double get_pitch() const { return pitch; }
- bool get_game_mode() const { return game_mode; }
- bool get_splash_screen() const { return splash_screen; }
- bool get_intro_music() const { return intro_music; }
- int get_mouse_pointer() const { return mouse_pointer; }
- bool get_pause() const { return pause; }
- bool get_hud_status() const { return hud_status; }
- bool get_panel_status() const { return panel_status; }
- bool get_sound() const { return sound; }
- int get_flight_model() const { return flight_model; }
- bool fog_enabled() const { return fog != FG_FOG_DISABLED; }
- fgFogKind get_fog() const { return fog; }
- double get_fov() const { return fov; }
- bool get_fullscreen() const { return fullscreen; }
- int get_shading() const { return shading; }
- bool get_skyblend() const { return skyblend; }
- bool get_textures() const { return textures; }
- bool get_wireframe() const { return wireframe; }
- int get_tile_radius() const { return tile_radius; }
- int get_tile_diameter() const { return tile_diameter; }
- int get_time_offset() const { return time_offset; }
- int get_tris_or_culled() const { return tris_or_culled; }
+ inline string get_fg_root() const { return fg_root; }
+ inline string get_airport_id() const { return airport_id; }
+ inline double get_lon() const { return lon; }
+ inline double get_lat() const { return lat; }
+ inline double get_altitude() const { return altitude; }
+ inline double get_heading() const { return heading; }
+ inline double get_roll() const { return roll; }
+ inline double get_pitch() const { return pitch; }
+ inline bool get_game_mode() const { return game_mode; }
+ inline bool get_splash_screen() const { return splash_screen; }
+ inline bool get_intro_music() const { return intro_music; }
+ inline int get_mouse_pointer() const { return mouse_pointer; }
+ inline bool get_pause() const { return pause; }
+ inline bool get_hud_status() const { return hud_status; }
+ inline bool get_panel_status() const { return panel_status; }
+ inline bool get_sound() const { return sound; }
+ inline int get_flight_model() const { return flight_model; }
+ inline bool fog_enabled() const { return fog != FG_FOG_DISABLED; }
+ inline fgFogKind get_fog() const { return fog; }
+ inline double get_fov() const { return fov; }
+ inline bool get_fullscreen() const { return fullscreen; }
+ inline int get_shading() const { return shading; }
+ inline bool get_skyblend() const { return skyblend; }
+ inline bool get_textures() const { return textures; }
+ inline bool get_wireframe() const { return wireframe; }
+ inline int get_xsize() const { return xsize; }
+ inline int get_ysize() const { return ysize; }
+ inline int get_tile_radius() const { return tile_radius; }
+ inline int get_tile_diameter() const { return tile_diameter; }
+
+ inline int get_units() const { return units; }
+ inline int get_tris_or_culled() const { return tris_or_culled; }
+
+ inline int get_time_offset() const { return time_offset; }
+
+ inline str_container get_port_options_list() const {
+ return port_options_list;
+ }
// Update functions
- void set_hud_status( bool status ) { hud_status = status; }
- void set_fov( double amount ) { fov = amount; }
- void set_textures( bool status ) { textures = status; }
- void cycle_fog( void ) {
+ inline void set_hud_status( bool status ) { hud_status = status; }
+ inline void set_fov( double amount ) { fov = amount; }
+ inline void set_textures( bool status ) { textures = status; }
+ inline void cycle_fog( void ) {
if ( fog == FG_FOG_DISABLED ) {
fog = FG_FOG_FASTEST;
} else if ( fog == FG_FOG_FASTEST ) {
xglHint ( GL_FOG_HINT, GL_FASTEST );
}
}
+ inline void set_xsize( int x ) { xsize= x; }
+ inline void set_ysize( int y ) { xsize= y; }
private:
double parse_degree( const string& degree_str );
int parse_time_offset( const string& time_str );
int parse_tile_radius( const string& arg );
- int parse_flight_model( const string& fm );
+ int parse_fdm( const string& fm );
double parse_fov( const string& arg );
+ bool parse_serial( const string& serial_str );
};
// $Log$
+// Revision 1.27 1999/02/05 21:29:13 curt
+// Modifications to incorporate Jon S. Berndts flight model code.
+//
+// Revision 1.26 1999/02/02 20:13:37 curt
+// MSVC++ portability changes by Bernie Bright:
+//
+// Lib/Serial/serial.[ch]xx: Initial Windows support - incomplete.
+// Simulator/Astro/stars.cxx: typo? included <stdio> instead of <cstdio>
+// Simulator/Cockpit/hud.cxx: Added Standard headers
+// Simulator/Cockpit/panel.cxx: Redefinition of default parameter
+// Simulator/Flight/flight.cxx: Replaced cout with FG_LOG. Deleted <stdio.h>
+// Simulator/Main/fg_init.cxx:
+// Simulator/Main/GLUTmain.cxx:
+// Simulator/Main/options.hxx: Shuffled <fg_serial.hxx> dependency
+// Simulator/Objects/material.hxx:
+// Simulator/Time/timestamp.hxx: VC++ friend kludge
+// Simulator/Scenery/tile.[ch]xx: Fixed using std::X declarations
+// Simulator/Main/views.hxx: Added a constant
+//
+// Revision 1.25 1999/01/19 20:57:06 curt
+// MacOS portability changes contributed by "Robert Puyol" <puyol@abvent.fr>
+//
+// Revision 1.24 1998/11/25 01:34:01 curt
+// Support for an arbitrary number of serial ports.
+//
+// Revision 1.23 1998/11/23 21:49:05 curt
+// Borland portability tweaks.
+//
+// Revision 1.22 1998/11/20 01:02:38 curt
+// Try to detect Mesa/Glide/Voodoo and chose the appropriate resolution.
+//
+// Revision 1.21 1998/11/16 14:00:04 curt
+// Added pow() macro bug work around.
+// Added support for starting FGFS at various resolutions.
+// Added some initial serial port support.
+// Specify default log levels in main().
+//
+// Revision 1.20 1998/11/02 23:04:05 curt
+// HUD units now display in feet by default with meters being a command line
+// option.
+//
+// Revision 1.19 1998/10/25 14:08:49 curt
+// Turned "struct fgCONTROLS" into a class, with inlined accessor functions.
+//
// Revision 1.18 1998/09/17 18:35:31 curt
// Added F8 to toggle fog and F9 to toggle texturing.
//