Include/fg_callback.hxx
Moved code inline to stop g++ 2.7 from complaining. Simulator/Time/event.[ch]xx Changed return type of fgEVENT::printStat(). void caused g++ 2.7 to complain bitterly. Minor bugfix and changes. Simulator/Main/GLUTmain.cxx Added missing type to idle_state definition - eliminates a warning. Simulator/Main/fg_init.cxx Changes to airport lookup. Simulator/Main/options.cxx Uses fg_gzifstream when loading config file.
This commit is contained in:
parent
b4abef6ab8
commit
c4dbcd55b1
5 changed files with 119 additions and 41 deletions
|
@ -93,7 +93,7 @@ fgGENERAL general;
|
|||
// Specify our current idle function state. This is used to run all
|
||||
// our initializations out of the glutIdleLoop() so that we can get a
|
||||
// splash screen up and running right away.
|
||||
static idle_state = 0;
|
||||
static int idle_state = 0;
|
||||
|
||||
// Another hack
|
||||
int use_signals = 0;
|
||||
|
@ -609,7 +609,6 @@ static void fgMainLoop( void ) {
|
|||
|
||||
static void fgIdleFunction ( void ) {
|
||||
fgGENERAL *g;
|
||||
|
||||
g = &general;
|
||||
|
||||
// printf("idle state == %d\n", idle_state);
|
||||
|
@ -889,6 +888,25 @@ int main( int argc, char **argv ) {
|
|||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.50 1998/09/15 02:09:24 curt
|
||||
// Include/fg_callback.hxx
|
||||
// Moved code inline to stop g++ 2.7 from complaining.
|
||||
//
|
||||
// Simulator/Time/event.[ch]xx
|
||||
// Changed return type of fgEVENT::printStat(). void caused g++ 2.7 to
|
||||
// complain bitterly.
|
||||
//
|
||||
// Minor bugfix and changes.
|
||||
//
|
||||
// Simulator/Main/GLUTmain.cxx
|
||||
// Added missing type to idle_state definition - eliminates a warning.
|
||||
//
|
||||
// Simulator/Main/fg_init.cxx
|
||||
// Changes to airport lookup.
|
||||
//
|
||||
// Simulator/Main/options.cxx
|
||||
// Uses fg_gzifstream when loading config file.
|
||||
//
|
||||
// Revision 1.49 1998/09/09 16:25:39 curt
|
||||
// Only use GLUT_STENCIL if the instument panel has been requested.
|
||||
//
|
||||
|
|
|
@ -91,15 +91,12 @@ int fgInitPosition( void ) {
|
|||
id.c_str() );
|
||||
|
||||
airports.load("apt_simple");
|
||||
a = airports.search( (char *)id.c_str() );
|
||||
if ( (fabs(a.longitude) < FG_EPSILON) &&
|
||||
(fabs(a.latitude) < FG_EPSILON) &&
|
||||
(fabs(a.elevation) < FG_EPSILON) ) {
|
||||
if ( ! airports.search( id, &a ) ) {
|
||||
fgPrintf( FG_GENERAL, FG_EXIT,
|
||||
"Failed to find %s in database.\n", id.c_str() );
|
||||
} else {
|
||||
FG_Longitude = ( a.longitude ) * DEG_TO_RAD;
|
||||
FG_Latitude = ( a.latitude ) * DEG_TO_RAD;
|
||||
FG_Longitude = a.longitude * DEG_TO_RAD;
|
||||
FG_Latitude = a.latitude * DEG_TO_RAD;
|
||||
}
|
||||
} else {
|
||||
// set initial position from default or command line coordinates
|
||||
|
@ -392,6 +389,25 @@ int fgInitSubsystems( void )
|
|||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.37 1998/09/15 02:09:26 curt
|
||||
// Include/fg_callback.hxx
|
||||
// Moved code inline to stop g++ 2.7 from complaining.
|
||||
//
|
||||
// Simulator/Time/event.[ch]xx
|
||||
// Changed return type of fgEVENT::printStat(). void caused g++ 2.7 to
|
||||
// complain bitterly.
|
||||
//
|
||||
// Minor bugfix and changes.
|
||||
//
|
||||
// Simulator/Main/GLUTmain.cxx
|
||||
// Added missing type to idle_state definition - eliminates a warning.
|
||||
//
|
||||
// Simulator/Main/fg_init.cxx
|
||||
// Changes to airport lookup.
|
||||
//
|
||||
// Simulator/Main/options.cxx
|
||||
// Uses fg_gzifstream when loading config file.
|
||||
//
|
||||
// Revision 1.36 1998/09/08 21:40:08 curt
|
||||
// Fixes by Charlie Hotchkiss.
|
||||
//
|
||||
|
|
|
@ -36,10 +36,13 @@
|
|||
#include <Debug/fg_debug.h>
|
||||
#include <Flight/flight.h>
|
||||
#include <Include/fg_constants.h>
|
||||
#include <Include/fg_zlib.h>
|
||||
#include <Misc/fgstream.hxx>
|
||||
|
||||
#include "options.hxx"
|
||||
|
||||
const int fgOPTIONS::FG_RADIUS_MIN;
|
||||
const int fgOPTIONS::FG_RADIUS_MAX;
|
||||
|
||||
inline double
|
||||
atof( const string& str )
|
||||
{
|
||||
|
@ -462,43 +465,27 @@ int fgOPTIONS::parse_command_line( int argc, char **argv ) {
|
|||
|
||||
// Parse config file options
|
||||
int fgOPTIONS::parse_config_file( const string& path ) {
|
||||
char line[256];
|
||||
fgFile f;
|
||||
int len;
|
||||
string fgpath = path + ".gz";
|
||||
|
||||
// first try "path.gz"
|
||||
if ( (f = fgopen(fgpath.c_str(), "rb")) == NULL ) {
|
||||
// next try "path"
|
||||
if ( (f = fgopen(path.c_str(), "rb")) == NULL ) {
|
||||
return(FG_OPTIONS_ERROR);
|
||||
}
|
||||
}
|
||||
fg_gzifstream in( path );
|
||||
if ( !in )
|
||||
return(FG_OPTIONS_ERROR);
|
||||
|
||||
fgPrintf( FG_GENERAL, FG_INFO, "Processing config file: %s\n",
|
||||
path.c_str() );
|
||||
|
||||
while ( fggets(f, line, 250) != NULL ) {
|
||||
// strip trailing newline if it exists
|
||||
len = strlen(line);
|
||||
if ( line[len-1] == '\n' ) {
|
||||
line[len-1] = '\0';
|
||||
}
|
||||
in.eat_comments();
|
||||
while ( !in.eof() )
|
||||
{
|
||||
string line;
|
||||
getline( in.stream(), line );
|
||||
|
||||
// strip dos ^M if it exists
|
||||
len = strlen(line);
|
||||
if ( line[len-1] == '\r' ) {
|
||||
line[len-1] = '\0';
|
||||
}
|
||||
|
||||
if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
|
||||
if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
|
||||
fgPrintf( FG_GENERAL, FG_EXIT,
|
||||
"Config file parse error: %s '%s'\n",
|
||||
path.c_str(), line );
|
||||
path.c_str(), line.c_str() );
|
||||
}
|
||||
in.eat_comments();
|
||||
}
|
||||
|
||||
fgclose(f);
|
||||
return FG_OPTIONS_OK;
|
||||
}
|
||||
|
||||
|
@ -579,6 +566,25 @@ fgOPTIONS::~fgOPTIONS( void ) {
|
|||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.25 1998/09/15 02:09:27 curt
|
||||
// Include/fg_callback.hxx
|
||||
// Moved code inline to stop g++ 2.7 from complaining.
|
||||
//
|
||||
// Simulator/Time/event.[ch]xx
|
||||
// Changed return type of fgEVENT::printStat(). void caused g++ 2.7 to
|
||||
// complain bitterly.
|
||||
//
|
||||
// Minor bugfix and changes.
|
||||
//
|
||||
// Simulator/Main/GLUTmain.cxx
|
||||
// Added missing type to idle_state definition - eliminates a warning.
|
||||
//
|
||||
// Simulator/Main/fg_init.cxx
|
||||
// Changes to airport lookup.
|
||||
//
|
||||
// Simulator/Main/options.cxx
|
||||
// Uses fg_gzifstream when loading config file.
|
||||
//
|
||||
// Revision 1.24 1998/09/08 15:04:33 curt
|
||||
// Optimizations by Norman Vine.
|
||||
//
|
||||
|
|
|
@ -128,7 +128,7 @@ fgEVENT::run()
|
|||
|
||||
|
||||
// Dump scheduling stats
|
||||
void
|
||||
int
|
||||
fgEVENT::PrintStats() const
|
||||
{
|
||||
printf(" %-30s int=%.2fs cum=%ld min=%ld max=%ld count=%ld ave=%.2f\n",
|
||||
|
@ -136,9 +136,9 @@ fgEVENT::PrintStats() const
|
|||
interval / 1000.0,
|
||||
cum_time, min_time, max_time, count,
|
||||
cum_time / (double)count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Constructor
|
||||
fgEVENT_MGR::fgEVENT_MGR( void ) {
|
||||
}
|
||||
|
@ -191,7 +191,6 @@ void fgEVENT_MGR::Suspend( void ) {
|
|||
void fgEVENT_MGR::Resume( void ) {
|
||||
}
|
||||
|
||||
|
||||
// Dump scheduling stats
|
||||
void
|
||||
fgEVENT_MGR::PrintStats()
|
||||
|
@ -259,6 +258,25 @@ fgEVENT_MGR::~fgEVENT_MGR( void ) {
|
|||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.8 1998/09/15 02:09:29 curt
|
||||
// Include/fg_callback.hxx
|
||||
// Moved code inline to stop g++ 2.7 from complaining.
|
||||
//
|
||||
// Simulator/Time/event.[ch]xx
|
||||
// Changed return type of fgEVENT::printStat(). void caused g++ 2.7 to
|
||||
// complain bitterly.
|
||||
//
|
||||
// Minor bugfix and changes.
|
||||
//
|
||||
// Simulator/Main/GLUTmain.cxx
|
||||
// Added missing type to idle_state definition - eliminates a warning.
|
||||
//
|
||||
// Simulator/Main/fg_init.cxx
|
||||
// Changes to airport lookup.
|
||||
//
|
||||
// Simulator/Main/options.cxx
|
||||
// Uses fg_gzifstream when loading config file.
|
||||
//
|
||||
// Revision 1.7 1998/08/29 13:11:31 curt
|
||||
// Bernie Bright writes:
|
||||
// I've created some new classes to enable pointers-to-functions and
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
FG_EVENT_QUEUED = 2
|
||||
};
|
||||
|
||||
fgEVENT(); // Required by deque<>.
|
||||
fgEVENT() {} // Required by deque<>.
|
||||
|
||||
fgEVENT( const string& desc,
|
||||
const fgCallback& cb,
|
||||
|
@ -81,7 +81,8 @@ public:
|
|||
|
||||
void run();
|
||||
|
||||
void PrintStats() const;
|
||||
// void PrintStats() const;
|
||||
int PrintStats() const;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -168,6 +169,25 @@ extern fgEVENT_MGR global_events;
|
|||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.11 1998/09/15 02:09:30 curt
|
||||
// Include/fg_callback.hxx
|
||||
// Moved code inline to stop g++ 2.7 from complaining.
|
||||
//
|
||||
// Simulator/Time/event.[ch]xx
|
||||
// Changed return type of fgEVENT::printStat(). void caused g++ 2.7 to
|
||||
// complain bitterly.
|
||||
//
|
||||
// Minor bugfix and changes.
|
||||
//
|
||||
// Simulator/Main/GLUTmain.cxx
|
||||
// Added missing type to idle_state definition - eliminates a warning.
|
||||
//
|
||||
// Simulator/Main/fg_init.cxx
|
||||
// Changes to airport lookup.
|
||||
//
|
||||
// Simulator/Main/options.cxx
|
||||
// Uses fg_gzifstream when loading config file.
|
||||
//
|
||||
// Revision 1.10 1998/09/08 21:41:06 curt
|
||||
// Added constructor for fgEVENT.
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue