- added faction preview images for Random and Observer types (thanks Elimnator)
- bugfix when choosing random faction and sometimes the game tries to load this as a real faction type
This commit is contained in:
parent
7564635643
commit
d96bf7f978
|
@ -223,38 +223,70 @@ string Game::findFactionLogoFile(const GameSettings *settings, Logger *logger,st
|
|||
|
||||
if(skipCustomLoadScreen == false && loadingImageUsed == false){
|
||||
// try to use a faction related loading screen
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Searching for faction loading screen\n",__FILE__,__FUNCTION__);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Searching for faction loading screen\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
for ( int i=0; i < settings->getFactionCount(); ++i ) {
|
||||
if( settings->getFactionControl(i) == ctHuman ||
|
||||
(settings->getFactionControl(i) == ctNetwork && settings->getThisFactionIndex() == i)){
|
||||
vector<string> pathList=config.getPathListForType(ptTechs,scenarioDir);
|
||||
for(int idx = 0; idx < pathList.size(); idx++) {
|
||||
const string path = pathList[idx]+ "/" +techName+ "/"+ "factions"+ "/"+ settings->getFactionTypeName(i);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] possible loading screen dir '%s'\n",__FILE__,__FUNCTION__,path.c_str());
|
||||
if(isdir(path.c_str()) == true) {
|
||||
vector<string> loadScreenList;
|
||||
findAll(path + "/" + factionLogoFilter, loadScreenList, false, false);
|
||||
if(loadScreenList.size() > 0) {
|
||||
//string factionLogo = path + "/" + "loading_screen.jpg";
|
||||
string factionLogo = path + "/" + loadScreenList[0];
|
||||
(settings->getFactionControl(i) == ctNetwork && settings->getThisFactionIndex() == i)) {
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] looking for loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str());
|
||||
//printf("In [%s::%s Line: %d] looking for loading screen '%s'\n",__FILE__,__FUNCTION__,__LINE__,settings->getFactionTypeName(i).c_str());
|
||||
if(settings->getFactionTypeName(i) == formatString(GameConstants::OBSERVER_SLOTNAME)) {
|
||||
const string factionLogo = "data/core/misc_textures/observer.jpg";
|
||||
//printf("In [%s::%s Line: %d] looking for loading screen '%s'\n",__FILE__,__FUNCTION__,__LINE__,factionLogo.c_str());
|
||||
|
||||
if(fileExists(factionLogo) == true) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str());
|
||||
if(fileExists(factionLogo) == true) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] found loading screen '%s'\n",__FILE__,__FUNCTION__,__LINE__,factionLogo.c_str());
|
||||
|
||||
result = factionLogo;
|
||||
if(logger != NULL) {
|
||||
logger->loadLoadingScreen(result);
|
||||
result = factionLogo;
|
||||
if(logger != NULL) {
|
||||
logger->loadLoadingScreen(result);
|
||||
}
|
||||
loadingImageUsed = true;
|
||||
}
|
||||
}
|
||||
else if(settings->getFactionTypeName(i) == formatString(GameConstants::RANDOMFACTION_SLOTNAME)) {
|
||||
const string factionLogo = "data/core/misc_textures/random.jpg";
|
||||
//printf("In [%s::%s Line: %d] looking for loading screen '%s'\n",__FILE__,__FUNCTION__,__LINE__,factionLogo.c_str());
|
||||
|
||||
if(fileExists(factionLogo) == true) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] found loading screen '%s'\n",__FILE__,__FUNCTION__,__LINE__,factionLogo.c_str());
|
||||
|
||||
result = factionLogo;
|
||||
if(logger != NULL) {
|
||||
logger->loadLoadingScreen(result);
|
||||
}
|
||||
loadingImageUsed = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
vector<string> pathList=config.getPathListForType(ptTechs,scenarioDir);
|
||||
for(int idx = 0; idx < pathList.size(); idx++) {
|
||||
const string path = pathList[idx]+ "/" +techName+ "/"+ "factions"+ "/"+ settings->getFactionTypeName(i);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] possible loading screen dir '%s'\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
|
||||
if(isdir(path.c_str()) == true) {
|
||||
vector<string> loadScreenList;
|
||||
findAll(path + "/" + factionLogoFilter, loadScreenList, false, false);
|
||||
if(loadScreenList.size() > 0) {
|
||||
//string factionLogo = path + "/" + "loading_screen.jpg";
|
||||
string factionLogo = path + "/" + loadScreenList[0];
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] looking for loading screen '%s'\n",__FILE__,__FUNCTION__,__LINE__,factionLogo.c_str());
|
||||
|
||||
if(fileExists(factionLogo) == true) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] found loading screen '%s'\n",__FILE__,__FUNCTION__,__LINE__,factionLogo.c_str());
|
||||
|
||||
result = factionLogo;
|
||||
if(logger != NULL) {
|
||||
logger->loadLoadingScreen(result);
|
||||
}
|
||||
loadingImageUsed = true;
|
||||
break;
|
||||
}
|
||||
loadingImageUsed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(loadingImageUsed == true) {
|
||||
break;
|
||||
if(loadingImageUsed == true) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -263,12 +295,12 @@ string Game::findFactionLogoFile(const GameSettings *settings, Logger *logger,st
|
|||
}
|
||||
if(skipCustomLoadScreen == false && loadingImageUsed == false){
|
||||
// try to use a tech related loading screen
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Searching for tech loading screen\n",__FILE__,__FUNCTION__);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Searching for tech loading screen\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
vector<string> pathList=config.getPathListForType(ptTechs,scenarioDir);
|
||||
for(int idx = 0; idx < pathList.size(); idx++) {
|
||||
const string path = pathList[idx]+ "/" +techName;
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] possible loading screen dir '%s'\n",__FILE__,__FUNCTION__,path.c_str());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] possible loading screen dir '%s'\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
|
||||
if(isdir(path.c_str()) == true) {
|
||||
vector<string> loadScreenList;
|
||||
findAll(path + "/" + factionLogoFilter, loadScreenList, false, false);
|
||||
|
@ -276,10 +308,10 @@ string Game::findFactionLogoFile(const GameSettings *settings, Logger *logger,st
|
|||
//string factionLogo = path + "/" + "loading_screen.jpg";
|
||||
string factionLogo = path + "/" + loadScreenList[0];
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] looking for loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] looking for loading screen '%s'\n",__FILE__,__FUNCTION__,__LINE__,factionLogo.c_str());
|
||||
|
||||
if(fileExists(factionLogo) == true) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] found loading screen '%s'\n",__FILE__,__FUNCTION__,__LINE__,factionLogo.c_str());
|
||||
|
||||
result = factionLogo;
|
||||
if(logger != NULL) {
|
||||
|
|
|
@ -872,8 +872,18 @@ void MenuStateCustomGame::PlayNow() {
|
|||
if(listBoxFactions[i].getSelectedItem() == formatString(GameConstants::RANDOMFACTION_SLOTNAME)) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] RandomCount = %d\n",__FILE__,__FUNCTION__,__LINE__,RandomCount);
|
||||
|
||||
listBoxFactions[i].setSelectedItemIndex(RandomCount);
|
||||
randomFactionSelectionList.push_back(listBoxFactions[i].getItem(RandomCount));
|
||||
// Find first real faction and use it
|
||||
int factionIndexToUse = RandomCount;
|
||||
for(int useIdx = 0; useIdx < listBoxFactions[i].getItemCount(); useIdx++) {
|
||||
string selectedFactionName = listBoxFactions[i].getItem(useIdx);
|
||||
if( selectedFactionName != formatString(GameConstants::RANDOMFACTION_SLOTNAME) &&
|
||||
selectedFactionName != formatString(GameConstants::OBSERVER_SLOTNAME)) {
|
||||
factionIndexToUse = useIdx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
listBoxFactions[i].setSelectedItemIndex(factionIndexToUse);
|
||||
randomFactionSelectionList.push_back(listBoxFactions[i].getItem(factionIndexToUse));
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] i = %d, listBoxFactions[i].getSelectedItem() [%s]\n",__FILE__,__FUNCTION__,__LINE__,i,listBoxFactions[i].getSelectedItem().c_str());
|
||||
|
|
Loading…
Reference in New Issue