From 4f01ddb1cc00fe82a08748f9d0fbe955c8d4e570 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Sun, 27 Nov 2022 14:31:46 +0000 Subject: [PATCH] WS30 - Remove log spam for missing tiles Previously any missing WS30 tiles created multiple OSG WARN messages from the file not being found. This change does a check to ensure the file actually exists before put it on the queue for loading. --- src/Scenery/tileentry.hxx | 5 ----- src/Scenery/tilemgr.cxx | 21 ++++++++++++++++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/Scenery/tileentry.hxx b/src/Scenery/tileentry.hxx index 1866e33c8..86bdd40c3 100644 --- a/src/Scenery/tileentry.hxx +++ b/src/Scenery/tileentry.hxx @@ -94,11 +94,6 @@ public: // properly drawn relative to our (0,0,0) point void prep_ssg_node(float vis); - /** - * Transition to OSG database pager - */ - static osg::Node* loadTileByFileName(const std::string& index_str, - const osgDB::Options*); /** * Return true if the tile entry is loaded, otherwise return false * indicating that the loading thread is still working on this. diff --git a/src/Scenery/tilemgr.cxx b/src/Scenery/tilemgr.cxx index 27f1f8313..7a94bb3f7 100644 --- a/src/Scenery/tilemgr.cxx +++ b/src/Scenery/tilemgr.cxx @@ -311,6 +311,25 @@ bool FGTileMgr::sched_tile( const SGBucket& b, double priority, bool current_vie { // create a new entry v = new VPBTileEntry( b ); + + // If we put the tile on the queue blindly and it doesn't exist, + // OSG created huge amounts of log spam and WARN level. So + // do a quick check here and drop out if the file doesn't exist. + bool found = false; + auto filePathList = _options->getDatabasePathList(); + for (auto path : filePathList) { + SGPath p(path, v->tileFileName); + if (p.exists()) { + found = true; + break; + } + } + + if (! found) { + delete v; + return false; + } + SG_LOG( SG_TERRAIN, SG_INFO, "sched_tile: new VPB tile entry for:" << b ); // insert the tile into the cache, update will generate load request @@ -328,7 +347,7 @@ bool FGTileMgr::sched_tile( const SGBucket& b, double priority, bool current_vie SG_LOG( SG_TERRAIN, SG_DEBUG, " New tile cache size " << (int)tile_cache.get_size() ); } - // update tile's properties. We ensure VPB tiles have maximum priority - priority is calcualated as + // update tile's properties. We ensure VPB tiles have maximum priority - priority is calculated as // _negative_ the square of the distance from the viewer to the tile. // so by multiplying by 0.1 we increase the number towards 0. tile_cache.request_tile(v,priority * 0.1,current_view,duration);