]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scripting/NasalPositioned_cppbind.cxx
Update/simplify for SimGear changes.
[flightgear.git] / src / Scripting / NasalPositioned_cppbind.cxx
index f37f5a26e127b31dec1c1c41eb9909b9435a9ce3..8d51624a88ea46daed72e174daca23e53841fb9c 100644 (file)
@@ -76,16 +76,6 @@ naRef to_nasal_helper(naContext c, flightgear::Approach* iap)
   return nasal::to_nasal(c, iap->ident());
 }
 
-//------------------------------------------------------------------------------
-naRef to_nasal_helper(naContext c, const SGGeod& pos)
-{
-  nasal::Hash hash(c);
-  hash.set("lat", pos.getLatitudeDeg());
-  hash.set("lon", pos.getLongitudeDeg());
-  hash.set("elevation", pos.getElevationM());
-  return hash.get_naRef();
-}
-
 //------------------------------------------------------------------------------
 static naRef f_navaid_course(naContext, FGNavRecord& nav)
 {
@@ -406,7 +396,8 @@ static naRef f_findWithinRange(nasal::CallContext ctx)
   SGGeod pos = getPosition(ctx);
   double range_nm = ctx.requireArg<double>(0);
 
-  FGPositioned::TypeFilter filter(FGPositioned::typeFromName(ctx.getArg<std::string>(1)));
+    std::string typeSpec = ctx.getArg<std::string>(1);
+    FGPositioned::TypeFilter filter(FGPositioned::TypeFilter::fromString(typeSpec));
     
   FGPositionedList items = FGPositioned::findWithinRange(pos, range_nm, &filter);
   FGPositioned::sortByRange(items, pos);
@@ -416,8 +407,8 @@ static naRef f_findWithinRange(nasal::CallContext ctx)
 static naRef f_findByIdent(nasal::CallContext ctx)
 {
   std::string prefix = ctx.requireArg<std::string>(0);
-  
-  FGPositioned::TypeFilter filter(FGPositioned::typeFromName(ctx.getArg<std::string>(1)));
+  std::string typeSpec = ctx.getArg<std::string>(1);
+  FGPositioned::TypeFilter filter(FGPositioned::TypeFilter::fromString(typeSpec));
   bool exact = ctx.getArg<bool>(2, false);
 
   return ctx.to_nasal( FGPositioned::findAllWithIdent(prefix, &filter, exact) );
@@ -426,8 +417,8 @@ static naRef f_findByIdent(nasal::CallContext ctx)
 static naRef f_findByName(nasal::CallContext ctx)
 {
   std::string prefix = ctx.requireArg<std::string>(0);
-  
-  FGPositioned::TypeFilter filter(FGPositioned::typeFromName(ctx.getArg<std::string>(1)));
+  std::string typeSpec = ctx.getArg<std::string>(1);
+  FGPositioned::TypeFilter filter(FGPositioned::TypeFilter::fromString(typeSpec));
   
   return ctx.to_nasal( FGPositioned::findAllWithName(prefix, &filter, false) );
 }
@@ -466,7 +457,7 @@ static naRef f_sortByRange(nasal::CallContext ctx)
 }
 
 //------------------------------------------------------------------------------
-naRef initNasalPositioned_cppbind(naRef globalsRef, naContext c, naRef gcSave)
+naRef initNasalPositioned_cppbind(naRef globalsRef, naContext c)
 {
   NasalPositioned::init("Positioned")
     .member("id", &FGPositioned::ident)
@@ -511,7 +502,7 @@ naRef initNasalPositioned_cppbind(naRef globalsRef, naContext c, naRef gcSave)
     .method("getStar", &FGAirport::findSTARWithIdent)
     .method("getIAP", &FGAirport::findApproachWithIdent)
     .method("tostring", &FGAirport::toString);
-
+    
   nasal::Hash globals(globalsRef, c),
               positioned( globals.createHash("positioned") );