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
#endif
+#include <Misc/fgpath.hxx>
+
#include "newbucket.hxx"
// long int index;
int top_lon, top_lat, main_lon, main_lat;
char hem, pole;
- char path[256];
-
- // index = gen_index();
+ char raw_path[256];
- path[0] = '\0';
-
top_lon = lon / 10;
main_lon = lon;
if ( (lon < 0) && (top_lon * 10 != lon) ) {
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();
}
FG_USING_STD(ostream);
#endif
+#ifdef __MWERKS__
+#include <math.h>
+#include <stdio.h>
+#endif
+
#include <Include/fg_constants.h>
// 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();
set_bucket(dlon, dlat);
}
+
// create an impossible bucket if false
inline FGBucket::FGBucket(const bool is_good) {
set_bucket(0.0, 0.0);
}
+// 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 );
FG_USING_STD(endl);
#endif
+#ifdef __MWERKS__
+FG_USING_STD(iostream);
+#endif
+
//
// TODO:
//
#ifdef FG_NDEBUG
# define FG_LOG(C,P,M)
+#elif defined( __MWERKS__ )
+# define FG_LOG(C,P,M) ::fglog() << ::loglevel(C,P) << M << std::endl
#else
# define FG_LOG(C,P,M) fglog() << loglevel(C,P) << M << endl
#endif
#include <Include/compiler.h>
+#ifdef __MWERKS__
+#include <stdlib.h> // for exit()
+#endif
+
#include STL_STRING
#include <Debug/logstream.hxx>
size = 0;
in >> skipcomment;
- while ( ! in.eof() ){
+ while ( in ) {
if ( size < MAX_TABLE_SIZE ) {
in >> table[size][0] >> table[size][1];
size++;
#define USE_XTRA_MAT3_INLINES
-/* ------------------------------ Types --------------------------------- */
-
-typedef double MAT3mat[4][4]; /* 4x4 matrix */
-typedef double MAT3vec[3]; /* Vector */
-typedef double MAT3hvec[4]; /* Vector with homogeneous coord */
-
-/* ------------------------------ Macros -------------------------------- */
-
-extern MAT3mat identityMatrix;
-
#if defined(i386)
#define USE_X86_ASM
#endif
return r;
}
#else
-#define FloatToInt(F) ((int) (F))
+#define FloatToInt(F) ((int) ((F) < 0.0f ? (F)-0.5f : (F)+0.5f))
#endif
+/* ------------------------------ Types --------------------------------- */
+
+typedef double MAT3mat[4][4]; /* 4x4 matrix */
+typedef double MAT3vec[3]; /* Vector */
+typedef double MAT3hvec[4]; /* Vector with homogeneous coord */
+
+/* ------------------------------ Macros -------------------------------- */
+
+extern MAT3mat identityMatrix;
/* Tests if a number is within EPSILON of zero */
#define MAT3_IS_ZERO(N) ((N) < MAT3_EPSILON && (N) > -MAT3_EPSILON)
# error This library requires C++
#endif
-#include "Include/compiler.h"
+#include <Include/compiler.h>
#ifdef FG_MATH_EXCEPTION_CLASH
# define exception c_exception
FG_USING_STD(istream);
#endif
-// -rp- assert.h is buggy under MWCWP3, as multiple #include undef assert !
+// -dw- someone seems to have forgotten this...
#ifdef __MWERKS__
-# define assert(x)
+FG_USING_STD(std);
#endif
+
const double fgPoint3_Epsilon = 0.0000001;
enum {PX, PY, PZ}; // axes