]> git.mxchange.org Git - simgear.git/blobdiff - Math/interpolater.cxx
Added point3d.hxx to replace cheezy fgPoint3d struct.
[simgear.git] / Math / interpolater.cxx
index 5c552a4e052fd7452c546777593273b7575d7a97..c77529e5554a1b824dd5836d594bc42fec91ecc2 100644 (file)
@@ -27,7 +27,7 @@
 #include <string.h>
 
 #include <Debug/fg_debug.h>
-#include <zlib/zlib.h>
+#include <Include/fg_zlib.h>
 
 #include "interpolater.hxx"
 
 // Constructor -- loads the interpolation table from the specified
 // file
 fgINTERPTABLE::fgINTERPTABLE( char *file ) {
-    char gzfile[256], line[256];
-    gzFile fd;
+    char fgfile[256], line[256];
+    fgFile fd;
 
     fgPrintf( FG_MATH, FG_INFO, "Initializing Interpolator for %s\n", file);
 
     // First try "file.gz"
-    strcpy(gzfile, file);
-    strcat(gzfile, ".gz");
-    if ( (fd = gzopen(gzfile, "r")) == NULL ) {
+    strcpy(fgfile, file);
+    strcat(fgfile, ".gz");
+    if ( (fd = fgopen(fgfile, "rb")) == NULL ) {
         // Next try "path"
-        if ( (fd = gzopen(file, "r")) == NULL ) {
-            fgPrintf(FG_MATH, FG_ALERT, "Cannot open file: %s\n", file);
+        if ( (fd = fgopen(file, "rb")) == NULL ) {
+            fgPrintf(FG_MATH, FG_EXIT, "Cannot open file: %s\n", file);
         }
     }
 
     size = 0;
-    while ( gzgets(fd, line, 250) != NULL ) {
+    while ( fggets(fd, line, 250) != NULL ) {
        if ( size < MAX_TABLE_SIZE ) {
            sscanf(line, "%lf %lf\n", &(table[size][0]), &(table[size][1]));
            size++;
        } else {
-            fgPrintf( FG_MATH, FG_ALERT, 
+            fgPrintf( FG_MATH, FG_EXIT, 
                      "fgInterpolateInit(): Exceed max table size = %d\n",
                      MAX_TABLE_SIZE );
        }
     }
 
-    gzclose(fd);
+    fgclose(fd);
 }
 
 
@@ -77,7 +77,7 @@ double fgINTERPTABLE::interpolate(double x) {
        i++;
     }
 
-    printf ("i = %d ", i);
+    // printf ("i = %d ", i);
 
     if ( (i == 0) && (x < table[0][0]) ) {
        fgPrintf( FG_MATH, FG_ALERT, 
@@ -107,10 +107,18 @@ fgINTERPTABLE::~fgINTERPTABLE( void ) {
 
 
 // $Log$
+// Revision 1.4  1998/05/13 18:24:25  curt
+// Wrapped zlib calls so zlib can be optionally disabled.
+//
+// Revision 1.3  1998/04/25 15:05:01  curt
+// Changed "r" to "rb" in gzopen() options.  This fixes bad behavior in win32.
+//
+// Revision 1.2  1998/04/22 13:18:10  curt
+// C++ - ified comments.  Make file open errors fatal.
+//
 // Revision 1.1  1998/04/21 19:14:23  curt
 // Modified Files:
 //     Makefile.am Makefile.in
 // Added Files:
 //     interpolater.cxx interpolater.hxx
 //
-//