When loading stg files honour the original path if given.

Modified Files:
	simgear/scene/tgdb/ReaderWriterSTG.cxx
	simgear/scene/tgdb/TileEntry.cxx
	simgear/scene/tgdb/TileEntry.hxx
This commit is contained in:
frohlich
2009-06-03 00:08:05 +02:00
committed by Tim Moore
parent 855e88da43
commit 2c66081fa4
3 changed files with 10 additions and 8 deletions
+1 -4
View File
@@ -56,10 +56,7 @@ osgDB::ReaderWriter::ReadResult
ReaderWriterSTG::readNode(const std::string& fileName, ReaderWriterSTG::readNode(const std::string& fileName,
const osgDB::ReaderWriter::Options* options) const const osgDB::ReaderWriter::Options* options) const
{ {
std::string tileName = osgDB::getNameLessExtension(fileName); osg::Node* result = TileEntry::loadTileByFileName(fileName, options);
tileName = osgDB::getSimpleFileName(tileName);
osg::Node* result = TileEntry::loadTileByName(tileName, options);
// For debugging race conditions // For debugging race conditions
#ifdef SLOW_PAGER #ifdef SLOW_PAGER
sleep(5); sleep(5);
+7 -2
View File
@@ -242,9 +242,12 @@ struct Object {
// what we'll want to do with the database pager. // what we'll want to do with the database pager.
osg::Node* osg::Node*
TileEntry::loadTileByName(const string& index_str, TileEntry::loadTileByFileName(const string& fileName,
const osgDB::ReaderWriter::Options* options) const osgDB::ReaderWriter::Options* options)
{ {
std::string index_str = osgDB::getNameLessExtension(fileName);
index_str = osgDB::getSimpleFileName(index_str);
long tileIndex; long tileIndex;
{ {
std::istringstream idxStream(index_str); 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 ); SG_LOG( SG_TERRAIN, SG_INFO, "Loading tile " << index_str );
osgDB::FilePathList path_list=options->getDatabasePathList(); 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 // scan and parse all files and store information
for (unsigned int i = 0; i < path_list.size(); i++) { for (unsigned int i = 0; i < path_list.size(); i++) {
+2 -2
View File
@@ -118,8 +118,8 @@ public:
/** /**
* Transition to OSG database pager * Transition to OSG database pager
*/ */
static osg::Node* loadTileByName(const std::string& index_str, static osg::Node* loadTileByFileName(const std::string& index_str,
const osgDB::ReaderWriter::Options*); const osgDB::ReaderWriter::Options*);
/** /**
* Return true if the tile entry is loaded, otherwise return false * Return true if the tile entry is loaded, otherwise return false
* indicating that the loading thread is still working on this. * indicating that the loading thread is still working on this.