Use a separaet asset class for library object to avoid hardcoding

the name of library directory (and avoid searching for files in
more than one directory).
This commit is contained in:
hiker 2014-09-30 10:47:10 +10:00
parent 768d843cfe
commit 584e909846
3 changed files with 6 additions and 4 deletions

View File

@ -114,13 +114,14 @@ FileManager::FileManager()
m_subdir_name[GFX ] = "gfx";
m_subdir_name[GRANDPRIX ] = "grandprix";
m_subdir_name[GUI ] = "gui";
m_subdir_name[LIBRARY ] = "library";
m_subdir_name[MODEL ] = "models";
m_subdir_name[MUSIC ] = "music";
m_subdir_name[TRANSLATION] = "po";
m_subdir_name[TEXTURE ] = "textures";
m_subdir_name[SFX ] = "sfx";
m_subdir_name[SKIN ] = "skins";
m_subdir_name[SHADER ] = "shaders";
m_subdir_name[TEXTURE ] = "textures";
m_subdir_name[TRANSLATION] = "po";
#ifdef __APPLE__
// irrLicht's createDevice method has a nasty habit of messing the CWD.
// since the code above may rely on it, save it to be able to restore

View File

@ -48,7 +48,7 @@ public:
* The last entry ASSET_COUNT specifies the number of entries. */
enum AssetType {ASSET_MIN,
CHALLENGE=ASSET_MIN,
FONT, GFX, GRANDPRIX, GUI, MODEL, MUSIC,
FONT, GFX, GRANDPRIX, GUI, LIBRARY, MODEL, MUSIC,
SFX, SHADER, SKIN, TEXTURE, TRANSLATION,
ASSET_MAX = TRANSLATION,
ASSET_COUNT};

View File

@ -1939,7 +1939,8 @@ void Track::loadObjects(const XMLNode* root, const std::string& path, ModelDefin
node->get("scale", &scale);
XMLNode* libroot;
std::string lib_path = file_manager->getAsset("library/" + name)+"/";
std::string lib_path =
file_manager->getAsset(FileManager::LIBRARY, name)+"/";
bool create_lod_definitions = true;
if (library_nodes.find(name) == library_nodes.end())