X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FScenery%2FFGTileLoader.cxx;h=3bbe26521f994e9a27932f5885287540ff890c84;hb=56592f3869c41e4f189e9ab44abb1a0898c90f4b;hp=661833e2824e7ee17477908d57a56a68801113a0;hpb=2afcbb4bc815e02f8b0c2e42f0047387b6bddb49;p=flightgear.git diff --git a/src/Scenery/FGTileLoader.cxx b/src/Scenery/FGTileLoader.cxx index 661833e28..3bbe26521 100644 --- a/src/Scenery/FGTileLoader.cxx +++ b/src/Scenery/FGTileLoader.cxx @@ -24,6 +24,8 @@ # include #endif +#include + #include
#include "FGTileLoader.hxx" #include "tileentry.hxx" @@ -64,6 +66,19 @@ FGTileLoader::~FGTileLoader() #endif // ENABLE_THREADS } + +#if 0 // we don't ever want to do this I don't think +/** + * + */ +void FGTileLoader::reinit() { + while ( !tile_load_queue.empty() ) { + tile_load_queue.pop(); + } +} +#endif + + /** * */ @@ -77,7 +92,7 @@ FGTileLoader::add( FGTileEntry* tile ) static bool beenhere = false; if (!beenhere) { - if ( globals->get_fg_scenery() != (string)"" ) { + if ( !globals->get_fg_scenery().empty() ) { tile_path.set( globals->get_fg_scenery() ); } else { tile_path.set( globals->get_fg_root() ); @@ -106,6 +121,7 @@ FGTileLoader::remove( FGTileEntry* tile ) void FGTileLoader::update() { + #ifdef ENABLE_THREADS // send a signal to the pager thread that it is allowed to load // another tile @@ -114,24 +130,29 @@ FGTileLoader::update() mutex.unlock(); #else if ( !tile_load_queue.empty() ) { - cout << "loading next tile ..." << endl; + // cout << "loading next tile ..." << endl; // load the next tile in the queue FGTileEntry* tile = tile_load_queue.front(); tile_load_queue.pop(); + tile->load( tile_path, true ); - FGTileMgr::loaded( tile ); + + FGTileMgr::ready_to_attach( tile ); } +#ifdef WISH_PLIB_WAS_THREADED // but it isn't if ( !tile_free_queue.empty() ) { - cout << "freeing next tile ..." << endl; + // cout << "freeing next tile ..." << endl; // free the next tile in the queue FGTileEntry* tile = tile_free_queue.front(); tile_free_queue.pop(); tile->free_tile(); delete tile; } +#endif #endif // ENABLE_THREADS + } @@ -161,7 +182,7 @@ FGTileLoader::LoaderThread::run() #ifdef WISH_PLIB_WAS_THREADED // but it isn't // Handle and pending removals while ( !loader->tile_free_queue.empty() ) { - cout << "freeing next tile ..." << endl; + // cout << "freeing next tile ..." << endl; // free the next tile in the queue FGTileEntry* tile = loader->tile_free_queue.pop(); tile->free_tile();