#endif
#include <simgear/compiler.h>
+#include <simgear/structure/exception.hxx>
#include <Main/globals.hxx>
#include "FGTileLoader.hxx"
*/
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
}
*/
FGTileLoader::~FGTileLoader()
{
-#ifdef ENABLE_THREADS
+#if defined(ENABLE_THREADS) && ENABLE_THREADS
// Wake up its time to die.
// queue_cond.broadcast();
{
/**
* 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)
- {
- if ( !globals->get_fg_scenery().empty() ) {
- tile_path = globals->get_fg_scenery();
- } else {
- SGPath tmp;
- 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 );
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();
}
-#ifdef ENABLE_THREADS
+#if defined(ENABLE_THREADS) && ENABLE_THREADS
/**
*
*/