]> git.mxchange.org Git - flightgear.git/blobdiff - JSBsim/FGCoefficient.cpp
Latest changes from Jon, plus ...
[flightgear.git] / JSBsim / FGCoefficient.cpp
index f0115909d80d08a220b83ea933d1244ca2f4c6b1..89c1ca1ef25ed4b05cd6274f405c2617dee633cb 100644 (file)
@@ -107,10 +107,7 @@ HISTORY
 INCLUDES
 *******************************************************************************/
 
-#include <stdio.h>
-#include <stdlib.h>
 #include "FGCoefficient.h"
-
 #include "FGAtmosphere.h"
 #include "FGState.h"
 #include "FGFDMExec.h"
@@ -143,7 +140,7 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex)
 }
 
 
-FGCoefficient::FGCoefficient(FGFDMExec* fdex, char* fname)
+FGCoefficient::FGCoefficient(FGFDMExec* fdex, string fname)
 {
   int r, c;
   float ftrashcan;
@@ -159,7 +156,7 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, char* fname)
   Auxiliary   = FDMExec->GetAuxiliary();
   Output      = FDMExec->GetOutput();
 
-  ifstream coeffDefFile(fname);
+  ifstream coeffDefFile(fname.c_str());
 
   if (coeffDefFile) {
     if (!coeffDefFile.fail()) {
@@ -167,21 +164,21 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, char* fname)
       coeffDefFile >> description;
       coeffDefFile >> method;
 
-      if (strcmp(method,"EQUATION") == 0) type = 4;
-      else if (strcmp(method,"TABLE") == 0) type = 3;
-      else if (strcmp(method,"VECTOR") == 0) type = 2;
-      else if (strcmp(method,"VALUE") == 0) type = 1;
-      else type = 0;
+      if      (method == "EQUATION") type = EQUATION;
+      else if (method == "TABLE")    type = TABLE;
+      else if (method == "VECTOR")   type = VECTOR;
+      else if (method == "VALUE")    type = VALUE;
+      else                           type = UNKNOWN;
 
-      if (type == 2 || type == 3) {
+      if (type == VECTOR || type == TABLE) {
         coeffDefFile >> rows;
-        if (type == 3) {
+        if (type == TABLE) {
           coeffDefFile >> columns;
         }
         coeffDefFile >> LookupR;
       }
 
-      if (type == 3) {
+      if (type == TABLE) {
         coeffDefFile >> LookupC;
       }
 
@@ -254,10 +251,10 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, char* fname)
       }
 
       switch(type) {
-      case 1:
+      case VALUE:
         coeffDefFile >> StaticValue;
         break;
-      case 2:
+      case VECTOR:
         Allocate(rows,2);
 
         for (r=1;r<=rows;r++) {
@@ -265,7 +262,7 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, char* fname)
           coeffDefFile >> Table3D[r][1];
         }
         break;
-      case 3:
+      case TABLE:
         Allocate(rows, columns);
 
         for (c=1;c<=columns;c++) {