MacOS portability improvements.

This commit is contained in:
curt
1999-04-27 15:54:39 +00:00
parent 489b562232
commit f8dde93e05
7 changed files with 51 additions and 25 deletions

View File

@@ -6,6 +6,8 @@ bin_PROGRAMS = testbucket
testbucket_SOURCES = testbucket.cxx
testbucket_LDADD = $(top_builddir)/Lib/Bucket/libBucket.a
testbucket_LDADD = \
$(top_builddir)/Lib/Bucket/libBucket.a \
$(top_builddir)/Lib/Misc/libMisc.a
INCLUDES += -I$(top_builddir)
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib

View File

@@ -28,6 +28,8 @@
#endif
#include <Misc/fgpath.hxx>
#include "newbucket.hxx"
@@ -36,12 +38,8 @@ string FGBucket::gen_base_path() const {
// long int index;
int top_lon, top_lat, main_lon, main_lat;
char hem, pole;
char path[256];
char raw_path[256];
// index = gen_index();
path[0] = '\0';
top_lon = lon / 10;
main_lon = lon;
if ( (lon < 0) && (top_lon * 10 != lon) ) {
@@ -74,11 +72,13 @@ string FGBucket::gen_base_path() const {
main_lat *= -1;
}
sprintf(path, "%c%03d%c%02d/%c%03d%c%02d",
hem, top_lon, pole, top_lat,
sprintf(raw_path, "%c%03d%c%02d/%c%03d%c%02d",
hem, top_lon, pole, top_lat,
hem, main_lon, pole, main_lat);
return path;
FGPath path( raw_path );
return path.get_path();
}

View File

@@ -44,6 +44,11 @@ FG_USING_STD(string);
FG_USING_STD(ostream);
#endif
#ifdef __MWERKS__
#include <math.h>
#include <stdio.h>
#endif
#include <Include/fg_constants.h>
@@ -81,6 +86,7 @@ public:
// Set the bucket params for the specified lat and lon
void set_bucket( double dlon, double dlat );
void make_bad ( void );
// Generate the unique scenery tile index for this bucket
long int gen_index();
@@ -209,6 +215,7 @@ inline FGBucket::FGBucket(const double dlon, const double dlat) {
set_bucket(dlon, dlat);
}
// create an impossible bucket if false
inline FGBucket::FGBucket(const bool is_good) {
set_bucket(0.0, 0.0);
@@ -296,6 +303,13 @@ inline double FGBucket::get_height() const {
}
// create an impossible bucket
inline void FGBucket::make_bad( void ) {
set_bucket(0.0, 0.0);
lon = -1000;
}
// offset a bucket struct by the specified tile units in the X & Y
// direction
FGBucket fgBucketOffset( double dlon, double dlat, int x, int y );