- when searching for hud, loop until we find a file

This commit is contained in:
Mark Vejvoda 2012-03-03 07:48:05 +00:00
parent 060d1f453d
commit 8b7e2a7b9e

View File

@ -538,9 +538,10 @@ void Game::loadHudTexture(const GameSettings *settings)
}
}
if(factionName != "") {
bool hudFound = false;
Config &config= Config::getInstance();
vector<string> pathList= config.getPathListForType(ptTechs, scenarioDir);
for(int idx= 0; idx < pathList.size(); idx++){
for(int idx= 0; hudFound == false && idx < pathList.size(); idx++){
string currentPath= pathList[idx];
endPathWithSlash(currentPath);
@ -549,18 +550,23 @@ void Game::loadHudTexture(const GameSettings *settings)
endPathWithSlash(path);
findAll(path + "hud.*", hudList, false, false);
if(hudList.empty() == false){
string hudImageFileName= path + hudList[0];
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled)
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] looking for a HUD '%s'\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,hudImageFileName.c_str());
if(fileExists(hudImageFileName) == true){
for(unsigned int hudIdx = 0; hudFound == false && hudIdx < hudList.size(); ++hudIdx) {
string hudImageFileName= path + hudList[hudIdx];
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] looking for a HUD [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,hudImageFileName.c_str());
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled)
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] found HUD image '%s'\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,hudImageFileName.c_str());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] looking for a HUD [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,hudImageFileName.c_str());
Texture2D* texture= Renderer::findFactionLogoTexture(hudImageFileName);
gui.setHudTexture(texture);
//printf("Hud texture found! \n");
break;
if(fileExists(hudImageFileName) == true){
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] found HUD image [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,hudImageFileName.c_str());
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled)
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] found HUD image [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,hudImageFileName.c_str());
Texture2D* texture= Renderer::findFactionLogoTexture(hudImageFileName);
gui.setHudTexture(texture);
hudFound = true;
//printf("Hud texture found! \n");
break;
}
}
}
}