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-05-24 06:38:58 +00:00
committed by Tim Moore
parent 855e88da43
commit 2c66081fa4
3 changed files with 10 additions and 8 deletions

View 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);

View 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++) {

View 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.