]> git.mxchange.org Git - simgear.git/commitdiff
When loading stg files honour the original path if given.
authorfrohlich <frohlich>
Sun, 24 May 2009 06:38:58 +0000 (06:38 +0000)
committerTim Moore <timoore@redhat.com>
Tue, 2 Jun 2009 22:08:05 +0000 (00:08 +0200)
Modified Files:
simgear/scene/tgdb/ReaderWriterSTG.cxx
simgear/scene/tgdb/TileEntry.cxx
simgear/scene/tgdb/TileEntry.hxx

simgear/scene/tgdb/ReaderWriterSTG.cxx
simgear/scene/tgdb/TileEntry.cxx
simgear/scene/tgdb/TileEntry.hxx

index ac4f105987d4762c52ab0611475b20fd02e3152b..f79638bb0335438f569edf3c2bc295404a0ef701 100644 (file)
@@ -56,10 +56,7 @@ osgDB::ReaderWriter::ReadResult
 ReaderWriterSTG::readNode(const std::string& fileName,
                           const osgDB::ReaderWriter::Options* options) const
 {
-    std::string tileName = osgDB::getNameLessExtension(fileName);
-    tileName = osgDB::getSimpleFileName(tileName);
-
-    osg::Node* result = TileEntry::loadTileByName(tileName, options);
+    osg::Node* result = TileEntry::loadTileByFileName(fileName, options);
     // For debugging race conditions
 #ifdef SLOW_PAGER
     sleep(5);
index 510fb9764292b14403cdb29d919ee9a26047fa23..41f9deddd0fb25311b494d3cd7efb99ee65ddd4d 100644 (file)
@@ -242,9 +242,12 @@ struct Object {
 // what we'll want to do with the database pager.
 
 osg::Node*
-TileEntry::loadTileByName(const string& index_str,
-                          const osgDB::ReaderWriter::Options* options)
+TileEntry::loadTileByFileName(const string& fileName,
+                              const osgDB::ReaderWriter::Options* options)
 {
+    std::string index_str = osgDB::getNameLessExtension(fileName);
+    index_str = osgDB::getSimpleFileName(index_str);
+
     long tileIndex;
     {
         std::istringstream idxStream(index_str);
@@ -261,6 +264,8 @@ TileEntry::loadTileByName(const string& index_str,
     SG_LOG( SG_TERRAIN, SG_INFO, "Loading tile " << index_str );
 
     osgDB::FilePathList path_list=options->getDatabasePathList();
+    // Make sure we find the original filename here...
+    path_list.push_front(osgDB::getFilePath(fileName));
 
     // scan and parse all files and store information
     for (unsigned int i = 0; i < path_list.size(); i++) {
index 3cd9e39d651ed5b0b5ed40fd0e1d08a49034139e..d12fa92009e9b3a725a7171f0a82774932fe4105 100644 (file)
@@ -118,8 +118,8 @@ public:
     /**
      * Transition to OSG database pager
      */
-    static osg::Node* loadTileByName(const std::string& index_str,
-                                     const osgDB::ReaderWriter::Options*);
+    static osg::Node* loadTileByFileName(const std::string& index_str,
+                                         const osgDB::ReaderWriter::Options*);
     /**
      * Return true if the tile entry is loaded, otherwise return false
      * indicating that the loading thread is still working on this.