From cff0022a164a2e3147ff7186d7b1dedcab900492 Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 11 Jan 2001 05:04:17 +0000 Subject: [PATCH] Miscellaneous MSVC porting fixes by Christian Mayer. --- src/Cockpit/hud.cxx | 5 +++-- src/Cockpit/hud_ladr.cxx | 4 ++-- src/Controls/controls.cxx | 10 ++++++---- src/FDM/JSBSim.cxx | 2 +- src/Main/main.cxx | 8 +++++++- src/Main/options.cxx | 4 ++-- src/Scenery/tileentry.cxx | 8 ++++---- 7 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/Cockpit/hud.cxx b/src/Cockpit/hud.cxx index 17082b830..65e00958c 100644 --- a/src/Cockpit/hud.cxx +++ b/src/Cockpit/hud.cxx @@ -20,6 +20,7 @@ // // $Id$ +#include #ifdef HAVE_CONFIG_H # include @@ -36,8 +37,8 @@ #include #include -#include -#include +#include STL_STRING +#include STL_FSTREAM #include #include diff --git a/src/Cockpit/hud_ladr.cxx b/src/Cockpit/hud_ladr.cxx index 081cb7c78..2e9524ac3 100644 --- a/src/Cockpit/hud_ladr.cxx +++ b/src/Cockpit/hud_ladr.cxx @@ -276,8 +276,8 @@ void HudLadder :: draw( void ) // velocity vector glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle for(count=0; count<50; count++) { - cosine = 6 * cos(count * 2 * M_PI/50.0); - sine = 6 * sin(count * 2 * M_PI/50.0); + cosine = 6 * cos(count * 2 * FG_PI/50.0); + sine = 6 * sin(count * 2 * FG_PI/50.0); glVertex2f(cosine+vel_x, sine+vel_y); } glEnd(); diff --git a/src/Controls/controls.cxx b/src/Controls/controls.cxx index d5152c739..97d6a8990 100644 --- a/src/Controls/controls.cxx +++ b/src/Controls/controls.cxx @@ -85,7 +85,8 @@ FGControls::bind () &FGControls::get_rudder, &FGControls::set_rudder); fgTie("/controls/flaps", this, &FGControls::get_flaps, &FGControls::set_flaps); - for (int index = 0; index < MAX_ENGINES; index++) { + int index; + for (index = 0; index < MAX_ENGINES; index++) { char name[32]; sprintf(name, "/controls/throttle[%d]", index); fgTie(name, this, index, @@ -103,7 +104,7 @@ FGControls::bind () &FGControls::get_mixture, &FGControls::set_mixture); fgTie("/controls/propellor-pitch/all", this, ALL_ENGINES, &FGControls::get_prop_advance, &FGControls::set_prop_advance); - for (int index = 0; index < MAX_WHEELS; index++) { + for (index = 0; index < MAX_WHEELS; index++) { char name[32]; sprintf(name, "/controls/brakes[%d]", index); fgTie(name, this, index, @@ -123,7 +124,8 @@ FGControls::unbind () fgUntie("/controls/elevator-trim"); fgUntie("/controls/rudder"); fgUntie("/controls/flaps"); - for (int index = 0; index < MAX_ENGINES; index++) { + int index; + for (index = 0; index < MAX_ENGINES; index++) { char name[32]; sprintf(name, "/controls/throttle[%d]", index); fgUntie(name); @@ -132,7 +134,7 @@ FGControls::unbind () sprintf(name, "/controls/propellor-pitch[%d]", index); fgUntie(name); } - for (int index = 0; index < MAX_WHEELS; index++) { + for (index = 0; index < MAX_WHEELS; index++) { char name[32]; sprintf(name, "/controls/brakes[%d]", index); fgUntie(name); diff --git a/src/FDM/JSBSim.cxx b/src/FDM/JSBSim.cxx index 590ea1362..9f0725377 100644 --- a/src/FDM/JSBSim.cxx +++ b/src/FDM/JSBSim.cxx @@ -245,7 +245,7 @@ bool FGJSBsim::update( int multiloop ) { } - for ( int i = 0; i < multiloop; i++ ) { + for ( i = 0; i < multiloop; i++ ) { fdmex->Run(); } diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 0b831e730..309c1f9d2 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -1398,8 +1398,14 @@ int main( int argc, char **argv ) { // set default log levels fglog().setLogLevels( FG_ALL, FG_INFO ); + string version; +#ifdef FLIGHTGEAR_VERSION + version = FLIGHTGEAR_VERSION; +#else + version = "unknown version"; +#endif FG_LOG( FG_GENERAL, FG_INFO, "FlightGear: Version " - << FLIGHTGEAR_VERSION << endl ); + << version << endl ); // seed the random number generater sg_srandom_time(); diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 857a07b56..8cc96f04b 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -929,9 +929,9 @@ int FGOptions::parse_option( const string& arg ) { } else if ( arg.find( "--view-offset=" ) != string::npos ) { string woffset = arg.substr( 14 ); if ( woffset == "LEFT" ) { - default_view_offset = M_PI * 0.25; + default_view_offset = FG_PI * 0.25; } else if ( woffset == "RIGHT" ) { - default_view_offset = M_PI * 1.75; + default_view_offset = FG_PI * 1.75; } else if ( woffset == "CENTER" ) { default_view_offset = 0.00; } else { diff --git a/src/Scenery/tileentry.cxx b/src/Scenery/tileentry.cxx index 5370d7858..dda39841a 100644 --- a/src/Scenery/tileentry.cxx +++ b/src/Scenery/tileentry.cxx @@ -95,8 +95,8 @@ void FGTileEntry::free_tile() { << " texture coordinate arrays" ); for ( i = 0; i < (int)vec3_ptrs.size(); ++i ) { -#ifdef macintosh - delete [] vec3_ptrs[i]; +#if defined(macintosh) || defined(_MSC_VER) + delete [] vec3_ptrs[i]; //that's the correct version #else delete vec3_ptrs[i]; #endif @@ -104,8 +104,8 @@ void FGTileEntry::free_tile() { vec3_ptrs.clear(); for ( i = 0; i < (int)vec2_ptrs.size(); ++i ) { -#ifdef macintosh - delete [] vec2_ptrs[i]; +#if defined(macintosh) || defined(_MSC_VER) + delete [] vec2_ptrs[i]; //that's the correct version #else delete vec2_ptrs[i]; #endif -- 2.39.5