MacOS fixes contributed by Darrell Walisser on 1/26/2000.
This commit is contained in:
parent
de21d794a7
commit
9a207fb4e1
14 changed files with 108 additions and 10 deletions
|
@ -132,7 +132,7 @@ class FGTurnCoordinator : public FGInstrument
|
|||
|
||||
public:
|
||||
FGTurnCoordinator (float inXPos, float inYPos);
|
||||
virtual FGTurnCoordinator::~FGTurnCoordinator (void);
|
||||
virtual ~FGTurnCoordinator (void);
|
||||
virtual void Init (void);
|
||||
virtual void Render(void);
|
||||
|
||||
|
|
|
@ -101,8 +101,8 @@ Control
|
|||
INCLUDES
|
||||
*******************************************************************************/
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef FGFS
|
||||
# ifndef __BORLANDC__
|
||||
|
@ -156,13 +156,17 @@ bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string f
|
|||
string holding_string;
|
||||
char scratch[128];
|
||||
ifstream coeffInFile;
|
||||
streampos gpos;
|
||||
streampos gpos(0);
|
||||
int axis;
|
||||
string axis_descript;
|
||||
bool readAeroRp=false;
|
||||
|
||||
axis = -1;
|
||||
#ifdef MACOS
|
||||
aircraftDef = aircraft_path + ":" + fname + ":" + fname + ".cfg";
|
||||
#else
|
||||
aircraftDef = aircraft_path + "/" + fname + "/" + fname + ".cfg";
|
||||
#endif
|
||||
ifstream aircraftfile(aircraftDef.c_str());
|
||||
cout << "Reading Aircraft Configuration File: " << aircraftDef << endl;
|
||||
// Output->SocketStatusOutput("Reading Aircraft Configuration File: " + aircraftDef);
|
||||
|
@ -175,7 +179,7 @@ bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string f
|
|||
while (!aircraftfile.fail()) {
|
||||
holding_string.erase();
|
||||
aircraftfile >> holding_string;
|
||||
#if defined(__BORLANDC__) || defined(FG_HAVE_NATIVE_SGI_COMPILERS) || defined(_MSC_VER)
|
||||
#if defined(__BORLANDC__) || defined(FG_HAVE_NATIVE_SGI_COMPILERS) || defined(_MSC_VER) || defined(__MWERKS__)
|
||||
if (holding_string.compare(0, 2, "//") != 0) {
|
||||
#else
|
||||
if (holding_string.compare("//",0,2) != 0) {
|
||||
|
|
|
@ -85,7 +85,11 @@ FGEngine::FGEngine(FGFDMExec* fdex, string enginePath, string engineName, int nu
|
|||
Output = FDMExec->GetOutput();
|
||||
|
||||
Name = engineName;
|
||||
#ifdef MACOS
|
||||
fullpath = enginePath + ":" + engineName + ".dat";
|
||||
#else
|
||||
fullpath = enginePath + "/" + engineName + ".dat";
|
||||
#endif
|
||||
ifstream enginefile(fullpath.c_str());
|
||||
|
||||
if (enginefile) {
|
||||
|
|
|
@ -64,8 +64,8 @@ class FGInitialCondition;
|
|||
class FGFDMExec
|
||||
{
|
||||
public:
|
||||
FGFDMExec::FGFDMExec(void);
|
||||
FGFDMExec::~FGFDMExec(void);
|
||||
FGFDMExec(void);
|
||||
~FGFDMExec(void);
|
||||
|
||||
FGModel* FirstModel;
|
||||
|
||||
|
|
|
@ -279,7 +279,11 @@ void FGOutput::SocketOutput(void)
|
|||
{
|
||||
string asciiData;
|
||||
|
||||
#ifdef MACOS
|
||||
if (socket == 0) return;
|
||||
#else
|
||||
if (socket <= 0) return;
|
||||
#endif
|
||||
|
||||
socket->Clear();
|
||||
if (sFirstPass) {
|
||||
|
|
|
@ -47,7 +47,7 @@ FGfdmSocket::FGfdmSocket(string address, int port)
|
|||
{
|
||||
size = 0;
|
||||
|
||||
#ifdef __BORLANDC__ || _MSC_VER
|
||||
#if defined( __BORLANDC__ ) || defined( _MSC_VER )
|
||||
WSADATA wsaData;
|
||||
int PASCAL FAR wsaReturnCode;
|
||||
wsaReturnCode = WSAStartup(MAKEWORD(1,1), &wsaData);
|
||||
|
@ -86,6 +86,10 @@ FGfdmSocket::FGfdmSocket(string address, int port)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MACOS
|
||||
/* commented out destructor method. shutdown method needs to link when
|
||||
we don't have networking enabled */
|
||||
#else
|
||||
FGfdmSocket::~FGfdmSocket(void)
|
||||
{
|
||||
if (sckt) shutdown(sckt,2);
|
||||
|
@ -93,6 +97,7 @@ FGfdmSocket::~FGfdmSocket(void)
|
|||
WSACleanup();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void FGfdmSocket::Clear(void)
|
||||
{
|
||||
|
|
|
@ -815,9 +815,11 @@ int fgOPTIONS::parse_config_file( const string& path ) {
|
|||
string line;
|
||||
|
||||
#ifdef GETLINE_NEEDS_TERMINATOR
|
||||
getline( in, line, '\n' );
|
||||
getline( in, line, '\n' );
|
||||
#elif defined (MACOS)
|
||||
getline( in, line, '\r' );
|
||||
#else
|
||||
getline( in, line );
|
||||
getline( in, line );
|
||||
#endif
|
||||
|
||||
if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
|
||||
|
|
|
@ -200,7 +200,11 @@ FGTileCache::fill_in( int index, const FGBucket& p )
|
|||
while ( ! in.eof() ) {
|
||||
in >> token;
|
||||
in >> name;
|
||||
#ifdef MACOS
|
||||
in >> ::skipws;
|
||||
#else
|
||||
in >> skipws;
|
||||
#endif
|
||||
cout << "token = " << token << " name = " << name << endl;
|
||||
|
||||
FGPath custom_path = tile_path;
|
||||
|
|
|
@ -98,12 +98,20 @@ void FGTileEntry::free_tile() {
|
|||
<< " texture coordinate arrays" );
|
||||
|
||||
for ( i = 0; i < (int)vec3_ptrs.size(); ++i ) {
|
||||
#ifdef MACOS
|
||||
delete [] vec3_ptrs[i];
|
||||
#else
|
||||
delete vec3_ptrs[i];
|
||||
#endif
|
||||
}
|
||||
vec3_ptrs.clear();
|
||||
|
||||
for ( i = 0; i < (int)vec2_ptrs.size(); ++i ) {
|
||||
#ifdef MACOS
|
||||
delete [] vec2_ptrs[i];
|
||||
#else
|
||||
delete vec2_ptrs[i];
|
||||
#endif
|
||||
}
|
||||
vec2_ptrs.clear();
|
||||
|
||||
|
|
|
@ -679,7 +679,9 @@ void FGTileMgr::my_ssg_los( string s, ssgBranch *branch, sgdMat4 m,
|
|||
{
|
||||
// cout << "sgLOS hit: " << result[0] << ","
|
||||
// << result[1] << "," << result[2] << endl;
|
||||
hit_pts[hitcount] = result;
|
||||
for (int i=0; i < 3; i++) {
|
||||
hit_pts[hitcount][i] = result[i];
|
||||
}
|
||||
hitcount++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -303,11 +303,16 @@ static void fgtzset_internal (int always, const char *tz)
|
|||
/* User specified the empty string; use UTC explicitly. */
|
||||
tz = "Universal";
|
||||
|
||||
#ifdef MACOS
|
||||
/* as you well know, mac paths contain leading colon, this code
|
||||
messes things up.... */
|
||||
#else
|
||||
/* A leading colon means "implementation defined syntax".
|
||||
We ignore the colon and always use the same algorithm:
|
||||
try a data file, and if none exists parse the 1003.1 syntax. */
|
||||
if (tz && *tz == ':')
|
||||
++tz;
|
||||
#endif
|
||||
|
||||
/* Check whether the value changes since the last run. */
|
||||
if (old_fgtz != NULL && tz != NULL && strcmp (tz, old_fgtz) == 0)
|
||||
|
|
|
@ -199,10 +199,18 @@ FGPhysicalProperty FGLocalWeatherDatabase::get(const sgVec3& p) const
|
|||
return FGPhysicalProperty(database->Evaluate(p), p[3]);
|
||||
}
|
||||
|
||||
#ifdef MACOS
|
||||
/* fix a problem with mw compilers in that they don't know the
|
||||
difference between the next two methods. Since the first one
|
||||
doesn't seem to be used anywhere, I commented it out. This is
|
||||
supposed to be fixed in the forthcoming CodeWarrior Release
|
||||
6. */
|
||||
#else
|
||||
FGPhysicalProperties FGLocalWeatherDatabase::get(const sgVec2& p) const
|
||||
{
|
||||
return database->Evaluate(p);
|
||||
}
|
||||
#endif
|
||||
|
||||
WeatherPrecision FGLocalWeatherDatabase::getAirDensity(const sgVec3& p) const
|
||||
{
|
||||
|
|
|
@ -158,7 +158,15 @@ public:
|
|||
/************************************************************************/
|
||||
/* Get the physical properties on the specified point p */
|
||||
/************************************************************************/
|
||||
#ifdef MACOS
|
||||
/* fix a problem with mw compilers in that they don't know the
|
||||
difference between the next two methods. Since the first one
|
||||
doesn't seem to be used anywhere, I commented it out. This is
|
||||
supposed to be fixed in the forthcoming CodeWarrior Release
|
||||
6. */
|
||||
#else
|
||||
FGPhysicalProperties get(const sgVec2& p) const;
|
||||
#endif
|
||||
FGPhysicalProperty get(const sgVec3& p) const;
|
||||
|
||||
WeatherPrecision getAirDensity(const sgVec3& p) const;
|
||||
|
|
|
@ -229,6 +229,49 @@ inline FGPhysicalProperties& FGPhysicalProperties::operator += (const FGPhysical
|
|||
return *this;
|
||||
}
|
||||
|
||||
// slightly modified version that also makes the Mac happy
|
||||
inline FGPhysicalProperties& FGPhysicalProperties::operator -= (const FGPhysicalProperties& p)
|
||||
{
|
||||
typedef map<FGPhysicalProperties::Altitude, FGWindItem>::const_iterator wind_iterator;
|
||||
typedef map<FGPhysicalProperties::Altitude, FGTurbulenceItem>::const_iterator turbulence_iterator;
|
||||
typedef map<FGPhysicalProperties::Altitude, WeatherPrecision>::const_iterator scalar_iterator;
|
||||
|
||||
// types to replace make_pair
|
||||
typedef map<FGPhysicalProperties::Altitude, FGWindItem>::value_type wind_type;
|
||||
typedef map<FGPhysicalProperties::Altitude, FGTurbulenceItem>::value_type turb_type;
|
||||
typedef map<FGPhysicalProperties::Altitude, WeatherPrecision>::value_type weather_type;
|
||||
|
||||
for (wind_iterator WindIt = p.Wind.begin();
|
||||
WindIt != p.Wind.end();
|
||||
WindIt++)
|
||||
if (!Wind.insert( wind_type(WindIt->first, -WindIt->second) ).second)
|
||||
// when it's not inserted => it's already existing
|
||||
Wind[WindIt->first] -= WindIt->second; //=> substract the value
|
||||
|
||||
for (turbulence_iterator TurbulenceIt = p.Turbulence.begin();
|
||||
TurbulenceIt != p.Turbulence.end();
|
||||
TurbulenceIt++)
|
||||
if (!Turbulence.insert( turb_type(TurbulenceIt->first, -TurbulenceIt->second) ).second)
|
||||
Turbulence[TurbulenceIt->first] -= TurbulenceIt->second;
|
||||
|
||||
for (scalar_iterator TemperatureIt = p.Temperature.begin();
|
||||
TemperatureIt != p.Temperature.end();
|
||||
TemperatureIt++)
|
||||
if (!Temperature.insert( weather_type(TemperatureIt->first, -TemperatureIt->second) ).second)
|
||||
Temperature[TemperatureIt->first] -= TemperatureIt->second;
|
||||
|
||||
AirPressure -= p.AirPressure.getValue();
|
||||
|
||||
for (scalar_iterator VaporPressureIt = p.VaporPressure.begin();
|
||||
VaporPressureIt != p.VaporPressure.end();
|
||||
VaporPressureIt++)
|
||||
if (!VaporPressure.insert( weather_type(VaporPressureIt->first, -VaporPressureIt->second) ).second)
|
||||
VaporPressure[VaporPressureIt->first] -= VaporPressureIt->second;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if 0 // old version
|
||||
inline FGPhysicalProperties& FGPhysicalProperties::operator -= (const FGPhysicalProperties& p)
|
||||
{
|
||||
typedef map<FGPhysicalProperties::Altitude, FGWindItem >::const_iterator wind_iterator;
|
||||
|
@ -264,6 +307,7 @@ inline FGPhysicalProperties& FGPhysicalProperties::operator -= (const FGPhysical
|
|||
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void FGPhysicalProperties::WindAt(sgVec3 ret, const WeatherPrecision a) const
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue