1
0
Fork 0

MSVC compatibility changes and code tweaks for minor nits caught by the

MSVC compiler.
This commit is contained in:
curt 2000-10-02 21:49:04 +00:00
parent df26bde4c4
commit 1dc35581f5
26 changed files with 146 additions and 24 deletions

View file

@ -194,7 +194,7 @@ bool FGAirportsUtil::dump_mk4( const string& file ) {
c4_Row row; c4_Row row;
iterator current = airports.begin(); const_iterator current = airports.begin();
const_iterator end = airports.end(); const_iterator end = airports.end();
while ( current != end ) { while ( current != end ) {
// add each airport record // add each airport record

View file

@ -28,6 +28,8 @@
# error This library requires C++ # error This library requires C++
#endif #endif
#include <simgear/compiler.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif

View file

@ -638,7 +638,8 @@ readInstrument (SGPropertyNode node, int x, int y, int real_w, int real_h)
// //
SGPropertyNode action_group = node.getSubNode("actions"); SGPropertyNode action_group = node.getSubNode("actions");
int nActions = action_group.size(); int nActions = action_group.size();
for (int j = 0; j < nActions; j++) { int j;
for (j = 0; j < nActions; j++) {
FGPanelAction * action = readAction(action_group.getChild(j), FGPanelAction * action = readAction(action_group.getChild(j),
hscale, vscale); hscale, vscale);
if (action == 0) { if (action == 0) {
@ -653,7 +654,7 @@ readInstrument (SGPropertyNode node, int x, int y, int real_w, int real_h)
// //
SGPropertyNode layer_group = node.getSubNode("layers"); SGPropertyNode layer_group = node.getSubNode("layers");
int nLayers = layer_group.size(); int nLayers = layer_group.size();
for (int j = 0; j < nLayers; j++) { for (j = 0; j < nLayers; j++) {
FGInstrumentLayer * layer = readLayer(layer_group.getChild(j), FGInstrumentLayer * layer = readLayer(layer_group.getChild(j),
hscale, vscale); hscale, vscale);
if (layer == 0) { if (layer == 0) {

View file

@ -57,6 +57,8 @@ private:
double rudder; double rudder;
double flaps; double flaps;
double throttle[MAX_ENGINES]; double throttle[MAX_ENGINES];
double mixture[MAX_ENGINES];
double prop_advance[MAX_ENGINES];
double brake[MAX_WHEELS]; double brake[MAX_WHEELS];
bool throttle_idle; bool throttle_idle;
@ -80,6 +82,10 @@ public:
inline double get_rudder() const { return rudder; } inline double get_rudder() const { return rudder; }
inline double get_flaps() const { return flaps; } inline double get_flaps() const { return flaps; }
inline double get_throttle(int engine) const { return throttle[engine]; } inline double get_throttle(int engine) const { return throttle[engine]; }
inline double get_mixture(int engine) const { return mixture[engine]; }
inline double get_prop_advance(int engine) const {
return prop_advance[engine];
}
inline double get_brake(int wheel) const { return brake[wheel]; } inline double get_brake(int wheel) const { return brake[wheel]; }
// Update functions // Update functions
@ -163,6 +169,58 @@ public:
} }
} }
} }
inline void set_mixture( int engine, double pos ) {
if ( engine == ALL_ENGINES ) {
for ( int i = 0; i < MAX_ENGINES; i++ ) {
mixture[i] = pos;
CLAMP( &mixture[i], 0.0, 1.0 );
}
} else {
if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
mixture[engine] = pos;
CLAMP( &mixture[engine], 0.0, 1.0 );
}
}
}
inline void move_mixture( int engine, double amt ) {
if ( engine == ALL_ENGINES ) {
for ( int i = 0; i < MAX_ENGINES; i++ ) {
mixture[i] += amt;
CLAMP( &mixture[i], 0.0, 1.0 );
}
} else {
if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
mixture[engine] += amt;
CLAMP( &mixture[engine], 0.0, 1.0 );
}
}
}
inline void set_prop_advance( int engine, double pos ) {
if ( engine == ALL_ENGINES ) {
for ( int i = 0; i < MAX_ENGINES; i++ ) {
prop_advance[i] = pos;
CLAMP( &prop_advance[i], 0.0, 1.0 );
}
} else {
if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
prop_advance[engine] = pos;
CLAMP( &prop_advance[engine], 0.0, 1.0 );
}
}
}
inline void move_prop_advance( int engine, double amt ) {
if ( engine == ALL_ENGINES ) {
for ( int i = 0; i < MAX_ENGINES; i++ ) {
prop_advance[i] += amt;
CLAMP( &prop_advance[i], 0.0, 1.0 );
}
} else {
if ( (engine >= 0) && (engine < MAX_ENGINES) ) {
prop_advance[engine] += amt;
CLAMP( &prop_advance[engine], 0.0, 1.0 );
}
}
}
inline void set_brake( int wheel, double pos ) { inline void set_brake( int wheel, double pos ) {
if ( wheel == ALL_WHEELS ) { if ( wheel == ALL_WHEELS ) {
for ( int i = 0; i < MAX_WHEELS; i++ ) { for ( int i = 0; i < MAX_WHEELS; i++ ) {

View file

@ -47,11 +47,15 @@
// INCLUDES // INCLUDES
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
#include <iostream.h> #include <simgear/compiler.h>
#include <iostream>
#include <math.h> #include <math.h>
#include "10520d.hxx" #include "10520d.hxx"
FG_USING_STD(cout);
FG_USING_STD(endl);
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// CODE // CODE

View file

@ -51,7 +51,7 @@
#define _10520D_HXX_ #define _10520D_HXX_
#include <iostream.h> #include <iostream>
#include <math.h> #include <math.h>

View file

@ -72,12 +72,15 @@
// //
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
#include <iostream.h> #include <simgear/compiler.h>
#include <fstream.h>
#include <iostream>
#include <fstream>
#include <math.h> #include <math.h>
#include "IO360.hxx" #include "IO360.hxx"
FG_USING_STD(cout);
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// CODE // CODE

View file

@ -56,11 +56,13 @@
#define PHILS_PROP_MODEL #define PHILS_PROP_MODEL
#endif #endif
#include <simgear/compiler.h>
#include <iostream.h> #include <iostream>
#include <fstream.h> #include <fstream>
#include <math.h> #include <math.h>
FG_USING_STD(ofstream);
class FGEngine { class FGEngine {

View file

@ -1,11 +1,13 @@
#ifndef _1D_DATA_FILE_READER_H_ #ifndef _1D_DATA_FILE_READER_H_
#define _1D_DATA_FILE_READER_H_ #define _1D_DATA_FILE_READER_H_
#include <strstream.h> #include <simgear/compiler.h>
#include <strstream>
#include "uiuc_parsefile.h" #include "uiuc_parsefile.h"
#include "uiuc_aircraft.h" #include "uiuc_aircraft.h"
int uiuc_1DdataFileReader( string file_name, int uiuc_1DdataFileReader( string file_name,
double x[100], double x[100],
double y[100], double y[100],

View file

@ -1,7 +1,10 @@
#ifndef _2D_DATA_FILE_READER_H_ #ifndef _2D_DATA_FILE_READER_H_
#define _2D_DATA_FILE_READER_H_ #define _2D_DATA_FILE_READER_H_
#include <strstream.h> #include <simgear/compiler.h>
#include <strstream>
#include "uiuc_parsefile.h" #include "uiuc_parsefile.h"
#include "uiuc_aircraft.h" #include "uiuc_aircraft.h"

View file

@ -94,8 +94,11 @@
#define _AIRCRAFT_H_ #define _AIRCRAFT_H_
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <map> #include <map>
#include <iostream> #include <iostream>
#include <math.h>
#include "uiuc_parsefile.h" #include "uiuc_parsefile.h"
FG_USING_STD(map); FG_USING_STD(map);

View file

@ -66,7 +66,7 @@
**********************************************************************/ **********************************************************************/
#include "uiuc_controlInput.h" #include "uiuc_controlInput.h"
#include <iostream.h> #include <iostream>
void uiuc_controlInput() void uiuc_controlInput()
{ {

View file

@ -4,8 +4,15 @@
#include "uiuc_aircraft.h" #include "uiuc_aircraft.h"
#include "uiuc_1Dinterpolation.h" #include "uiuc_1Dinterpolation.h"
#ifdef __cplusplus
extern "C" {
#endif
extern double Simtime; extern double Simtime;
#ifdef __cplusplus
}
#endif
void uiuc_controlInput(); void uiuc_controlInput();

View file

@ -3,8 +3,15 @@
#include "uiuc_aircraft.h" #include "uiuc_aircraft.h"
#ifdef __cplusplus
extern "C" {
#endif
extern double Simtime; extern double Simtime;
#ifdef __cplusplus
}
#endif
void uiuc_ice_eta(); void uiuc_ice_eta();

View file

@ -89,8 +89,14 @@
**********************************************************************/ **********************************************************************/
#include <simgear/compiler.h>
#include "uiuc_menu.h" #include "uiuc_menu.h"
#include <iostream.h> #include <iostream>
FG_USING_STD(cerr);
FG_USING_STD(cout);
FG_USING_STD(endl);
bool check_float(string &token) bool check_float(string &token)
{ {

View file

@ -1,12 +1,12 @@
#ifndef _PARSE_FILE_H_ #ifndef _PARSE_FILE_H_
#define _PARSE_FILE_H_ #define _PARSE_FILE_H_
#include <simgear/compiler.h>
#include <string> #include <string>
#include <list> #include <list>
#include <fstream> #include <fstream>
#include <simgear/compiler.h>
FG_USING_STD(list); FG_USING_STD(list);
FG_USING_STD(string); FG_USING_STD(string);
FG_USING_STD(ifstream); FG_USING_STD(ifstream);

View file

@ -8,8 +8,16 @@
#include <FDM/LaRCsim/ls_cockpit.h> #include <FDM/LaRCsim/ls_cockpit.h>
#include <FDM/LaRCsim/ls_constants.h> #include <FDM/LaRCsim/ls_constants.h>
#ifdef __cplusplus
extern "C" {
#endif
extern double Simtime; extern double Simtime;
#ifdef __cplusplus
}
#endif
void uiuc_recorder(double dt ); void uiuc_recorder(double dt );
#endif //_RECORDER_H #endif //_RECORDER_H

View file

@ -1,10 +1,12 @@
#ifndef _WARNINGS_ERRORS_H_ #ifndef _WARNINGS_ERRORS_H_
#define _WARNINGS_ERRORS_H_ #define _WARNINGS_ERRORS_H_
#include <simgear/compiler.h>
#include <string> #include <string>
#include <iostream> #include <iostream>
using std::string; FG_USING_STD(string);
void uiuc_warnings_errors(int errorCode, string line); void uiuc_warnings_errors(int errorCode, string line);

View file

@ -63,6 +63,8 @@
**********************************************************************/ **********************************************************************/
#include <simgear/compiler.h>
#include "uiuc_aircraft.h" #include "uiuc_aircraft.h"
#include "uiuc_aircraftdir.h" #include "uiuc_aircraftdir.h"
#include "uiuc_coefficients.h" #include "uiuc_coefficients.h"
@ -73,6 +75,9 @@
#include "uiuc_betaprobe.h" #include "uiuc_betaprobe.h"
#include <FDM/LaRCsim/ls_generic.h> #include <FDM/LaRCsim/ls_generic.h>
FG_USING_STD(cout);
FG_USING_STD(endl);
extern "C" void uiuc_init_aeromodel (); extern "C" void uiuc_init_aeromodel ();
extern "C" void uiuc_force_moment(double dt); extern "C" void uiuc_force_moment(double dt);
extern "C" void uiuc_engine_routine(); extern "C" void uiuc_engine_routine();

View file

@ -949,7 +949,7 @@ public:
} }
inline void add_engine( FGEngInterface e ) { inline void add_engine( FGEngInterface e ) {
return engines.push_back( e ); engines.push_back( e );
} }
}; };

View file

@ -49,10 +49,13 @@
// INCLUDES // INCLUDES
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
#include <iostream.h> #include <simgear/compiler.h>
// #include <stdio.h>
#include <iostream>
#include <math.h> #include <math.h>
// #include "10520c.h"
FG_USING_STD(cout);
FG_USING_STD(endl);
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// CODE // CODE

View file

@ -21,6 +21,7 @@
// //
// $Id$ // $Id$
#include <simgear/compiler.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
@ -39,7 +40,8 @@
#include <plib/js.h> #include <plib/js.h>
#include "joystick.hxx" #include "joystick.hxx"
using std::string; FG_USING_STD(string);
FG_USING_STD(cout);
#ifdef WIN32 #ifdef WIN32
static const int MAX_JOYSTICKS = 2; static const int MAX_JOYSTICKS = 2;

View file

@ -124,7 +124,7 @@ FGBFI::init ()
getRoll, setRoll); getRoll, setRoll);
// Engine // Engine
current_properties.tieDouble("/engine0/rpm", current_properties.tieDouble("/engines/engine0/rpm",
getRPM, setRPM); getRPM, setRPM);
// Velocities // Velocities

View file

@ -20,6 +20,7 @@
// //
// $Id$ // $Id$
#include <simgear/compiler.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>

View file

@ -21,6 +21,7 @@
// //
// $Id$ // $Id$
#include <simgear/compiler.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>

View file

@ -26,10 +26,12 @@
#include <simgear/io/iochannel.hxx> #include <simgear/io/iochannel.hxx>
#include <simgear/math/sg_types.hxx> #include <simgear/math/sg_types.hxx>
#include <strstream.h> #include <strstream>
#include "props.hxx" #include "props.hxx"
FG_USING_STD(cout);
FG_USING_STD(istrstream);
FGProps::FGProps() { FGProps::FGProps() {
} }