Removed usage of deprecated irrlicht IO interface, cleaned up usage

of different file archives (since irrlicht now supports removing paths
from a file archive).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4100 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2009-10-09 00:37:29 +00:00
parent b01fdba268
commit 1b877c9a16
2 changed files with 42 additions and 12 deletions

View File

@ -132,10 +132,10 @@ FileManager::FileManager()
TrackManager::addTrackSearchDir(m_root_dir+"/data/tracks");
KartPropertiesManager::addKartSearchDir(m_root_dir+"/data/karts");
pushTextureSearchPath(m_root_dir+"/data/textures");
pushModelSearchPath (m_root_dir+"/data/models" );
pushMusicSearchPath (m_root_dir+"/data/music" );
m_file_system->addFolderFileArchive("data/models",
pushTextureSearchPath(m_root_dir+"/data/textures/");
pushModelSearchPath (m_root_dir+"/data/models/" );
pushMusicSearchPath (m_root_dir+"/data/music/" );
m_file_system->addFileArchive("data/models/",
/*ignoreCase*/false,
/*ignorePaths*/false);
// Add more paths from the STK_MUSIC_PATH environment variable
@ -196,24 +196,53 @@ XMLNode *FileManager::createXMLTree(const std::string &filename)
return new XMLNode(xml_reader);
} // getXMLTree
//-----------------------------------------------------------------------------
/** In order to add and later remove paths we have to specify the absolute
* filename (and replace '\' with '/' on windows).
*/
io::path FileManager::createAbsoluteFilename(const std::string &f)
{
io::path abs_path=m_file_system->getAbsolutePath(f.c_str());
abs_path=m_file_system->flattenFilename(abs_path);
return abs_path;
} // createAbsoluteFilename
//-----------------------------------------------------------------------------
void FileManager::pushModelSearchPath(const std::string& path)
{
m_model_search_path.push_back(path);
m_file_system->addFolderFileArchive(path.c_str(),
/*ignoreCase*/false,
/*ignorePaths*/false);
m_file_system->addFileArchive(createAbsoluteFilename(path),
/*ignoreCase*/false,
/*ignorePaths*/false,
io::EFAT_FOLDER);
} // pushModelSearchPath
//-----------------------------------------------------------------------------
void FileManager::pushTextureSearchPath(const std::string& path)
{
m_texture_search_path.push_back(path);
m_file_system->addFolderFileArchive(path.c_str(),
/*ignoreCase*/false,
/*ignorePaths*/false);
m_file_system->addFileArchive(createAbsoluteFilename(path),
/*ignoreCase*/false,
/*ignorePaths*/false,
io::EFAT_FOLDER);
} // pushTextureSearchPath
//-----------------------------------------------------------------------------
void FileManager::popTextureSearchPath()
{
std::string dir = m_texture_search_path.back();
m_texture_search_path.pop_back();
m_file_system->removeFileArchive(createAbsoluteFilename(dir));
} // popTextureSearchPath
//-----------------------------------------------------------------------------
void FileManager::popModelSearchPath()
{
std::string dir = m_model_search_path.back();
m_model_search_path.pop_back();
m_file_system->removeFileArchive(createAbsoluteFilename(dir));
} // popModelSearchPath
//-----------------------------------------------------------------------------
bool FileManager::findFile(std::string& full_path,
const std::string& fname,

View File

@ -50,6 +50,7 @@ private:
const;
void makePath (std::string& path, const std::string& dir,
const std::string& fname) const;
io::path createAbsoluteFilename(const std::string &f);
public:
FileManager();
@ -89,8 +90,8 @@ public:
void pushModelSearchPath (const std::string& path);
void pushMusicSearchPath (const std::string& path)
{ m_music_search_path.push_back(path); }
void popTextureSearchPath () {m_texture_search_path.pop_back(); }
void popModelSearchPath () {m_model_search_path.pop_back(); }
void popTextureSearchPath ();
void popModelSearchPath ();
void popMusicSearchPath () {m_music_search_path.pop_back(); }
};