- cache the techname and selected faction when doing a faction preview in lobbies

This commit is contained in:
Mark Vejvoda 2010-10-30 03:29:29 +00:00
parent b1ff035f9e
commit 465ae629ba
4 changed files with 40 additions and 14 deletions

View File

@ -52,6 +52,9 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
switchSetupRequestFlagType |= ssrft_NetworkPlayerName;
updateDataSynchDetailText = false;
currentTechName_factionPreview="";
currentFactionName_factionPreview="";
currentFactionLogo = "";
factionTexture=NULL;
lastMissingMap="";
@ -999,6 +1002,12 @@ void MenuStateConnectedGame::update() {
if( clientInterface != NULL && clientInterface->isConnected() &&
gameSettings != NULL) {
if( currentTechName_factionPreview != gameSettings->getTech() ||
currentFactionName_factionPreview != gameSettings->getFactionTypeName(gameSettings->getThisFactionIndex())) {
currentTechName_factionPreview=gameSettings->getTech();
currentFactionName_factionPreview=gameSettings->getFactionTypeName(gameSettings->getThisFactionIndex());
string factionLogo = Game::findFactionLogoFile(gameSettings, NULL,"preview_screen.*");
if(factionLogo == "") {
factionLogo = Game::findFactionLogoFile(gameSettings, NULL);
@ -1009,6 +1018,7 @@ void MenuStateConnectedGame::update() {
}
}
}
}
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();

View File

@ -116,6 +116,9 @@ private:
bool enableFactionTexturePreview;
bool enableMapPreview;
string currentTechName_factionPreview;
string currentFactionName_factionPreview;
string currentFactionLogo;
Texture2D *factionTexture;

View File

@ -57,6 +57,8 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
generalErrorToShow = "---";
currentFactionLogo = "";
factionTexture=NULL;
currentTechName_factionPreview="";
currentFactionName_factionPreview="";
publishToMasterserverThread = NULL;
Lang &lang= Lang::getInstance();
@ -1554,6 +1556,13 @@ void MenuStateCustomGame::update() {
if(chrono.getMillis() > 0) chrono.start();
if(enableFactionTexturePreview == true) {
if( currentTechName_factionPreview != gameSettings.getTech() ||
currentFactionName_factionPreview != gameSettings.getFactionTypeName(gameSettings.getThisFactionIndex())) {
currentTechName_factionPreview=gameSettings.getTech();
currentFactionName_factionPreview=gameSettings.getFactionTypeName(gameSettings.getThisFactionIndex());
string factionLogo = Game::findFactionLogoFile(&gameSettings, NULL,"preview_screen.*");
if(factionLogo == "") {
factionLogo = Game::findFactionLogoFile(&gameSettings, NULL);
@ -1563,6 +1572,7 @@ void MenuStateCustomGame::update() {
loadFactionTexture(currentFactionLogo);
}
}
}
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
if(chrono.getMillis() > 0) chrono.start();

View File

@ -125,6 +125,9 @@ private:
bool enableFactionTexturePreview;
bool enableMapPreview;
string currentTechName_factionPreview;
string currentFactionName_factionPreview;
string currentFactionLogo;
Texture2D *factionTexture;