Make use of the new SGPath::add() function and automatically append 'Terren' and 'Objects' the the scenery path when one or both of those subdirectories exsist.
This commit is contained in:
parent
1bdcbd69f3
commit
079890e955
3 changed files with 34 additions and 9 deletions
|
@ -117,6 +117,38 @@ void FGGlobals::set_fg_root (const string &root) {
|
|||
}
|
||||
}
|
||||
|
||||
void FGGlobals::set_fg_scenery (const string &scenery) {
|
||||
|
||||
if (scenery.empty())
|
||||
return;
|
||||
|
||||
SGPath pt( scenery ), po( scenery );
|
||||
pt.append("Terrain");
|
||||
po.append("Objects");
|
||||
|
||||
cout << "pt: " << pt.str() << endl;
|
||||
cout << "po: " << po.str() << endl;
|
||||
ulDir *td = ulOpenDir(pt.c_str());
|
||||
ulDir *od = ulOpenDir(po.c_str());
|
||||
|
||||
if (td == NULL) {
|
||||
if (od == NULL) {
|
||||
fg_scenery = scenery;
|
||||
} else {
|
||||
fg_scenery = po.str();
|
||||
ulCloseDir(od);
|
||||
}
|
||||
} else {
|
||||
if (od != NULL) {
|
||||
pt.add(po.str());
|
||||
ulCloseDir(od);
|
||||
}
|
||||
fg_scenery = pt.str();
|
||||
ulCloseDir(td);
|
||||
}
|
||||
cout << "fg_scenery: " << fg_scenery << endl;
|
||||
}
|
||||
|
||||
|
||||
SGSubsystemMgr *
|
||||
FGGlobals::get_subsystem_mgr () const
|
||||
|
|
|
@ -237,9 +237,7 @@ public:
|
|||
void set_fg_root (const string &root);
|
||||
|
||||
inline const string &get_fg_scenery () const { return fg_scenery; }
|
||||
inline void set_fg_scenery (const string &scenery) {
|
||||
fg_scenery = scenery;
|
||||
}
|
||||
void set_fg_scenery (const string &scenery);
|
||||
|
||||
#if defined(FX) && defined(XMESA)
|
||||
inline bool get_fullscreen() const { return fullscreen; }
|
||||
|
|
|
@ -99,12 +99,7 @@ FGTileLoader::add( FGTileEntry* tile )
|
|||
SGPath tmp;
|
||||
tmp.set( globals->get_fg_root() );
|
||||
tmp.append( "Scenery/Terrain" );
|
||||
#ifdef _MSC_VER
|
||||
tmp.append( ";");
|
||||
#else
|
||||
tmp.append( ":");
|
||||
#endif
|
||||
tmp.append(globals->get_fg_root() );
|
||||
tmp.add(globals->get_fg_root() );
|
||||
tmp.append( "Scenery/Objects" );
|
||||
tile_path = tmp.str();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue