]> git.mxchange.org Git - flightgear.git/blobdiff - src/Canvas/FGCanvasSystemAdapter.cxx
VoiceSynthesizer: add some test/debug properties
[flightgear.git] / src / Canvas / FGCanvasSystemAdapter.cxx
index 576e859b1cecdbc3b5e5b014bc04235550a8fa6a..69ea6c5a4b20b1e5f3ae470fc91a6cb0ac9d8dbf 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <Main/globals.hxx>
 #include <Main/util.hxx>
-#include <Scripting/NasalSys.hxx>
+#include <Network/HTTPClient.hxx>
 #include <Viewer/renderer.hxx>
 
 #include <osgDB/ReadFile>
@@ -72,7 +72,8 @@ namespace canvas
   //----------------------------------------------------------------------------
   void FGCanvasSystemAdapter::removeCamera(osg::Camera* camera) const
   {
-    globals->get_renderer()->removeCamera(camera);
+    if( globals->get_renderer() )
+      globals->get_renderer()->removeCamera(camera);
   }
 
   //----------------------------------------------------------------------------
@@ -98,50 +99,19 @@ namespace canvas
     return 0;
   }
 
-  /**
-   * Get current FGNasalSys instance.
-   */
-  static FGNasalSys* getNasalSys()
-  {
-    static FGNasalSys* nasal_sys = 0;
-    // TODO if Nasal is able to be removed and/or recreated at runtime we need
-    //      to ensure that always the current instance is used
-    if( !nasal_sys )
-    {
-      nasal_sys = dynamic_cast<FGNasalSys*>(globals->get_subsystem("nasal"));
-      if( !nasal_sys )
-        throw std::runtime_error("FGCanvasSystemAdapter: no NasalSys");
-    }
-
-    return nasal_sys;
-  }
-
-  //----------------------------------------------------------------------------
-  naContext FGCanvasSystemAdapter::getNasalContext() const
-  {
-    return getNasalSys()->context();
-  }
-
   //----------------------------------------------------------------------------
-  int FGCanvasSystemAdapter::gcSave(naRef r)
+  simgear::HTTP::Client* FGCanvasSystemAdapter::getHTTPClient() const
   {
-    return getNasalSys()->gcSave(r);
-  }
+    FGHTTPClient* http =
+      static_cast<FGHTTPClient*>(globals->get_subsystem("http"));
 
-  //----------------------------------------------------------------------------
-  void FGCanvasSystemAdapter::gcRelease(int key)
-  {
-    getNasalSys()->gcRelease(key);
-  }
+    if( http )
+      return http->client();
 
-  //------------------------------------------------------------------------------
-  naRef FGCanvasSystemAdapter::callMethod( naRef code,
-                                           naRef self,
-                                           int argc,
-                                           naRef* args,
-                                           naRef locals )
-  {
-    return getNasalSys()->callMethod(code, self, argc, args, locals);
+    SG_LOG( SG_IO,
+            SG_ALERT,
+            "FGCanvasSystemAdapter: Failed to get HTTP subsystem" );
+    return 0;
   }
 
 }