From 89960ab7152fd59dee39824bd8cb44af7802884f Mon Sep 17 00:00:00 2001 From: curt Date: Wed, 13 Sep 2000 19:29:01 +0000 Subject: [PATCH] MacOS portability tweaks from Darrell Walisser. --- simgear/compiler.h | 2 +- simgear/ephemeris/ephemeris.hxx | 20 ++++++------ simgear/ephemeris/mercury.hxx | 4 +-- simgear/ephemeris/moon.hxx | 4 +-- simgear/ephemeris/star.hxx | 2 +- simgear/metar/MetarStation.cpp | 54 ++++++++++++++++----------------- simgear/misc/props.cxx | 36 +++++++++++----------- simgear/misc/props.hxx | 2 +- simgear/sky/sky.cxx | 8 ++--- simgear/sky/sky.hxx | 10 +++--- simgear/timing/sg_time.hxx | 2 +- simgear/timing/timezone.h | 3 +- 12 files changed, 73 insertions(+), 74 deletions(-) diff --git a/simgear/compiler.h b/simgear/compiler.h index dbd20658..1cad5dfb 100644 --- a/simgear/compiler.h +++ b/simgear/compiler.h @@ -118,7 +118,7 @@ # define bcopy(from, to, n) memcpy(to, from, n) // -rp- please use FG_MEM_COPY everywhere ! -# define FG_MEM_COPY(to,from,n) memcpy(to, from, n) +// #define FG_MEM_COPY(to,from,n) memcpy(to, from, n) // -dw- currently used glut has no game mode stuff # define GLUT_WRONG_VERSION diff --git a/simgear/ephemeris/ephemeris.hxx b/simgear/ephemeris/ephemeris.hxx index 880a0469..64c0b73b 100644 --- a/simgear/ephemeris/ephemeris.hxx +++ b/simgear/ephemeris/ephemeris.hxx @@ -36,16 +36,16 @@ #include -#include "star.hxx" -#include "moon.hxx" -#include "mercury.hxx" -#include "venus.hxx" -#include "mars.hxx" -#include "jupiter.hxx" -#include "saturn.hxx" -#include "uranus.hxx" -#include "neptune.hxx" -#include "stars.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include class SGEphemeris { diff --git a/simgear/ephemeris/mercury.hxx b/simgear/ephemeris/mercury.hxx index 9b098313..aecf8dc1 100644 --- a/simgear/ephemeris/mercury.hxx +++ b/simgear/ephemeris/mercury.hxx @@ -25,8 +25,8 @@ #ifndef _MERCURY_HXX_ #define _MERCURY_HXX_ -#include "celestialBody.hxx" -#include "star.hxx" +#include +#include class Mercury : public CelestialBody { diff --git a/simgear/ephemeris/moon.hxx b/simgear/ephemeris/moon.hxx index 1ee1e3b5..94958d6d 100644 --- a/simgear/ephemeris/moon.hxx +++ b/simgear/ephemeris/moon.hxx @@ -28,8 +28,8 @@ #include -#include "celestialBody.hxx" -#include "star.hxx" +#include +#include class Moon : public CelestialBody { diff --git a/simgear/ephemeris/star.hxx b/simgear/ephemeris/star.hxx index b345aa01..b28eff98 100644 --- a/simgear/ephemeris/star.hxx +++ b/simgear/ephemeris/star.hxx @@ -26,7 +26,7 @@ #define _STAR_HXX_ -#include "celestialBody.hxx" +#include class Star : public CelestialBody diff --git a/simgear/metar/MetarStation.cpp b/simgear/metar/MetarStation.cpp index e5067923..d7ead145 100644 --- a/simgear/metar/MetarStation.cpp +++ b/simgear/metar/MetarStation.cpp @@ -100,44 +100,42 @@ CMetarStation::CMetarStation( int CMetarStation::initialize() { - // Read the list of metar stations, decoding and adding to global list. + // Read the list of metar stations, decoding and adding to global list. - CMetarStation *m; - char buf[256]; + CMetarStation *m; + char buf[256]; - // Goto the Flight Gear installation directory + // Goto the Flight Gear installation directory #ifdef TESTPROG - FGPath weatherPath( "/mkv/Build/FlightGear" ); + //FGPath weatherPath( "/mkv/Build/FlightGear" ); + FGPath weatherPath( ":Data" ); #else FGPath weatherPath( current_options.get_fg_root() ); #endif - weatherPath.append( "Weather/MetarStations" ); - // Open the metar station list - FILE *f = fopen( weatherPath.c_str(), "r" ); + weatherPath.append( "Weather" ); + weatherPath.append( "MetarStations" ); + // Open the metar station list + FILE *f = fopen( weatherPath.c_str(), "r" ); - if ( f != NULL ) - { - // Read each line, create an instance of a station, and add it to the vector - while ( fgets( buf, 256, f) != NULL && feof( f ) == 0 ) - { - //std::cout << buf << std::endl; - m = new CMetarStation( buf ); - //m->dump(); - METAR_Stations.push_back( m ); - } - - // Close the list - fclose( f ); - std::cout << METAR_Stations.size() << " Metar stations" << std::endl; - return 1; - } - else - { - std::cout << "Could not open MetarStations file " << std::endl; - return 0; + if ( f != NULL ) { + // Read each line, create an instance of a station, and add it to the vector + while ( fgets( buf, 256, f) != NULL && feof( f ) == 0 ) { + //std::cout << buf << std::endl; + m = new CMetarStation( buf ); + //m->dump(); + METAR_Stations.push_back( m ); } + + // Close the list + fclose( f ); + // std::cout << METAR_Stations.size() << " Metar stations" << std::endl; + return 1; + } else { + // std::cout << "Could not open MetarStations file " << std::endl; + return 0; + } } diff --git a/simgear/misc/props.cxx b/simgear/misc/props.cxx index d7de035b..f952ef47 100644 --- a/simgear/misc/props.cxx +++ b/simgear/misc/props.cxx @@ -491,8 +491,8 @@ SGValue::setUnknownValue (const string &value) * Returns true on success (i.e. the value is not currently tied). */ bool -SGValue::tieBool (bool_getter getter, bool_setter setter = 0, - bool useDefault = true) +SGValue::tieBool (bool_getter getter, bool_setter setter, + bool useDefault) { if (_tied) { return false; @@ -517,8 +517,8 @@ SGValue::tieBool (bool_getter getter, bool_setter setter = 0, * Returns true on success (i.e. the value is not currently tied). */ bool -SGValue::tieInt (int_getter getter, int_setter setter = 0, - bool useDefault = true) +SGValue::tieInt (int_getter getter, int_setter setter, + bool useDefault) { if (_tied) { return false; @@ -543,8 +543,8 @@ SGValue::tieInt (int_getter getter, int_setter setter = 0, * Returns true on success (i.e. the value is not currently tied). */ bool -SGValue::tieFloat (float_getter getter, float_setter setter = 0, - bool useDefault = true) +SGValue::tieFloat (float_getter getter, float_setter setter, + bool useDefault) { if (_tied) { return false; @@ -569,8 +569,8 @@ SGValue::tieFloat (float_getter getter, float_setter setter = 0, * Returns true on success (i.e. the value is not currently tied). */ bool -SGValue::tieDouble (double_getter getter, double_setter setter = 0, - bool useDefault = true) +SGValue::tieDouble (double_getter getter, double_setter setter, + bool useDefault) { if (_tied) { return false; @@ -595,8 +595,8 @@ SGValue::tieDouble (double_getter getter, double_setter setter = 0, * Returns true on success (i.e. the value is not currently tied). */ bool -SGValue::tieString (string_getter getter, string_setter setter = 0, - bool useDefault = true) +SGValue::tieString (string_getter getter, string_setter setter, + bool useDefault) { if (_tied) { return false; @@ -693,7 +693,7 @@ SGPropertyList::~SGPropertyList () * and must not end with '/'. */ SGValue * -SGPropertyList::getValue (const string &name, bool create = false) +SGPropertyList::getValue (const string &name, bool create) { const_iterator el = _props.find(name); if (el == _props.end()) { @@ -914,7 +914,7 @@ bool SGPropertyList::tieBool (const string &name, bool_getter getter, bool_setter setter, - bool useDefault = true) + bool useDefault) { FG_LOG(FG_GENERAL, FG_INFO, "Tying bool property '" << name << '\''); return getValue(name, true)->tieBool(getter, setter, useDefault); @@ -930,7 +930,7 @@ bool SGPropertyList::tieInt (const string &name, int_getter getter, int_setter setter, - bool useDefault = true) + bool useDefault) { FG_LOG(FG_GENERAL, FG_INFO, "Tying int property '" << name << '\''); return getValue(name, true)->tieInt(getter, setter, useDefault); @@ -946,7 +946,7 @@ bool SGPropertyList::tieFloat (const string &name, float_getter getter, float_setter setter, - bool useDefault = true) + bool useDefault) { FG_LOG(FG_GENERAL, FG_INFO, "Tying float property '" << name << '\''); return getValue(name, true)->tieFloat(getter, setter, useDefault); @@ -962,7 +962,7 @@ bool SGPropertyList::tieDouble (const string &name, double_getter getter, double_setter setter, - bool useDefault = true) + bool useDefault) { FG_LOG(FG_GENERAL, FG_INFO, "Tying double property '" << name << '\''); return getValue(name, true)->tieDouble(getter, setter, useDefault); @@ -978,7 +978,7 @@ bool SGPropertyList::tieString (const string &name, string_getter getter, string_setter setter, - bool useDefault = true) + bool useDefault) { FG_LOG(FG_GENERAL, FG_INFO, "Tying string property '" << name << '\''); return getValue(name, true)->tieString(getter, setter, useDefault); @@ -1037,8 +1037,8 @@ get_base (const string &parent, const string &child, /** * Constructor. */ -SGPropertyNode::SGPropertyNode (const string &path = "", - SGPropertyList * props = 0) +SGPropertyNode::SGPropertyNode (const string &path, + SGPropertyList * props) : _props(props), _node(0) { setPath(path); diff --git a/simgear/misc/props.hxx b/simgear/misc/props.hxx index 0f31c24c..221f72fb 100644 --- a/simgear/misc/props.hxx +++ b/simgear/misc/props.hxx @@ -420,6 +420,6 @@ extern bool writePropertyList (const string &file, extern SGPropertyList current_properties; -#endif __PROPS_HXX +#endif // __PROPS_HXX // end of props.hxx diff --git a/simgear/sky/sky.cxx b/simgear/sky/sky.cxx index 07acea9a..70a74586 100644 --- a/simgear/sky/sky.cxx +++ b/simgear/sky/sky.cxx @@ -267,10 +267,10 @@ void SGSky::add_cloud_layer( double asl, double thickness, cloud_layers.push_back( layer ); } - for ( int i = 0; i < (int)cloud_layers.size(); ++i ) { - cout << "layer " << i << " = " << cloud_layers[i]->get_asl() << endl; - } - cout << endl; + // for ( int i = 0; i < (int)cloud_layers.size(); ++i ) { + // cout << "layer " << i << " = " << cloud_layers[i]->get_asl() << endl; + // } + // cout << endl; } diff --git a/simgear/sky/sky.hxx b/simgear/sky/sky.hxx index 5a5d4de8..4a5b9393 100644 --- a/simgear/sky/sky.hxx +++ b/simgear/sky/sky.hxx @@ -39,11 +39,11 @@ #include -#include "cloud.hxx" -#include "dome.hxx" -#include "moon.hxx" -#include "oursun.hxx" -#include "stars.hxx" +#include +#include +#include +#include +#include FG_USING_STD(vector); diff --git a/simgear/timing/sg_time.hxx b/simgear/timing/sg_time.hxx index 0c0f0408..319afec6 100644 --- a/simgear/timing/sg_time.hxx +++ b/simgear/timing/sg_time.hxx @@ -43,7 +43,7 @@ # include #endif -#include "timezone.h" +#include // Define a structure containing time parameters diff --git a/simgear/timing/timezone.h b/simgear/timing/timezone.h index 9e1424fe..ce3521be 100644 --- a/simgear/timing/timezone.h +++ b/simgear/timing/timezone.h @@ -30,9 +30,10 @@ #ifndef _TIMEZONE_H_ #define _TIMEZONE_H_ -#include "geocoord.h" #include +#include + class Timezone : public GeoCoord { private: -- 2.39.5