]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/FGTileLoader.cxx
Mathias Fröhlich:
[flightgear.git] / src / Scenery / FGTileLoader.cxx
index d229ed33cca6ea1f9d0524b295518304b68d8098..03cb493d56e89ac88c18e0509d27a0e0fea5a69b 100644 (file)
@@ -25,6 +25,7 @@
 #endif
 
 #include <simgear/compiler.h>
+#include <simgear/structure/exception.hxx>
 
 #include <Main/globals.hxx>
 #include "FGTileLoader.hxx"
 extern ssgBranch *terrain;
 extern ssgBranch *ground;
 
+
 /**
  * 
  */
 FGTileLoader::FGTileLoader()
 {
-#ifdef ENABLE_THREADS
+#if defined(ENABLE_THREADS) && ENABLE_THREADS
     // Create and start the loader threads.
     for (int i = 0; i < MAX_THREADS; ++i)
     {
        threads[i] = new LoaderThread(this);
-       threads[i]->start();
+       threads[i]->start( 1 );
     }
 #endif // ENABLE_THREADS
 }
@@ -54,7 +56,7 @@ FGTileLoader::FGTileLoader()
  */
 FGTileLoader::~FGTileLoader()
 {
-#ifdef ENABLE_THREADS
+#if defined(ENABLE_THREADS) && ENABLE_THREADS
     // Wake up its time to die.
     // queue_cond.broadcast();
 
@@ -87,20 +89,15 @@ FGTileLoader::add( FGTileEntry* tile )
 {
     /**
      * Initialise tile_path here and not in ctor to avoid problems
-     * with the initialastion order of global objects.
+     * with the initialisation order of global objects.
      */
     static bool beenhere = false;
-    if (!beenhere)
-    {
-        SGPath tmp;
-       if ( !globals->get_fg_scenery().empty() ) {
-           tmp.set( globals->get_fg_scenery() );
-       } else {
-           tmp.set( globals->get_fg_root() );
-            tmp.append( "Scenery" );
-       }
-        tile_path = tmp.str();
-       beenhere = true;
+    if (!beenhere) {
+        tile_path = globals->get_fg_scenery();
+        if (!tile_path.size())
+            throw sg_throwable(string("No valid scenery path defined!"));
+
+        beenhere = true;
     }
 
     tile_load_queue.push( tile );
@@ -124,7 +121,7 @@ void
 FGTileLoader::update()
 {
 
-#ifdef ENABLE_THREADS
+#if defined(ENABLE_THREADS) && ENABLE_THREADS
     // send a signal to the pager thread that it is allowed to load
     // another tile
     mutex.lock();
@@ -158,7 +155,7 @@ FGTileLoader::update()
 }
 
 
-#ifdef ENABLE_THREADS
+#if defined(ENABLE_THREADS) && ENABLE_THREADS
 /**
  * 
  */