From 6ce69a1e0b8458274976632b8c01c8863346bb44 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 31 Aug 2010 06:38:27 +0000 Subject: [PATCH] - added new messagebox prompt on server when data synch check enabled and data is different we stop the server from launching the game. - added faction preview texture when users change their faction selection --- source/glest_game/game/game.cpp | 153 ++++++++++++++- source/glest_game/game/game.h | 2 + source/glest_game/graphics/renderer.cpp | 2 +- .../menu/menu_state_connected_game.cpp | 77 +++++++- .../menu/menu_state_connected_game.h | 8 + .../menu/menu_state_custom_game.cpp | 183 +++++++++++++----- .../glest_game/menu/menu_state_custom_game.h | 6 + 7 files changed, 381 insertions(+), 50 deletions(-) diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index 38fed4f4..d9d15875 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -153,17 +153,168 @@ int Game::ErrorDisplayMessage(const char *msg, bool exitApp) { return 0; } +string Game::findFactionLogoFile(const GameSettings *settings, Logger *logger) { + string result = ""; + if(settings == NULL) { + result = ""; + } + //Logger &logger= Logger::getInstance(); + string mapName= settings->getMap(); + string tilesetName= settings->getTileset(); + string techName= settings->getTech(); + string scenarioName= settings->getScenario(); + bool loadingImageUsed=false; + + if(logger != NULL) { + logger->setState(Lang::getInstance().get("Loading")); + + if(scenarioName.empty()){ + logger->setSubtitle(formatString(mapName)+" - "+formatString(tilesetName)+" - "+formatString(techName)); + } + else{ + logger->setSubtitle(formatString(scenarioName)); + } + } + + Config &config = Config::getInstance(); + //good_fpu_control_registers(NULL,__FILE__,__FUNCTION__,__LINE__); + + //bool skipCustomLoadScreen = true; + bool skipCustomLoadScreen = false; + + string scenarioDir = ""; + if(skipCustomLoadScreen == false && settings->getScenarioDir() != "") { + scenarioDir = settings->getScenarioDir(); + if(EndsWith(scenarioDir, ".xml") == true) { + scenarioDir = scenarioDir.erase(scenarioDir.size() - 4, 4); + scenarioDir = scenarioDir.erase(scenarioDir.size() - settings->getScenario().size(), settings->getScenario().size() + 1); + } + // use a scenario based loading screen + vector loadScreenList; + findAll(scenarioDir + "loading_screen.*", loadScreenList, false, false); + if(loadScreenList.size() > 0) { + //string senarioLogo = scenarioDir + "/" + "loading_screen.jpg"; + string senarioLogo = scenarioDir + loadScreenList[0]; + if(fileExists(senarioLogo) == true) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found scenario loading screen '%s'\n",__FILE__,__FUNCTION__,senarioLogo.c_str()); + + result = senarioLogo; + if(logger != NULL) { + logger->loadLoadingScreen(result); + } + loadingImageUsed=true; + } + } + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] gameSettings.getScenarioDir() = [%s] gameSettings.getScenario() = [%s] scenarioDir = [%s]\n",__FILE__,__FUNCTION__,__LINE__,settings->getScenarioDir().c_str(),settings->getScenario().c_str(),scenarioDir.c_str()); + } + + // give CPU time to update other things to avoid apperance of hanging + //sleep(0); + //SDL_PumpEvents(); + + 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__); + for ( int i=0; i < settings->getFactionCount(); ++i ) { + if( settings->getFactionControl(i) == ctHuman || + (settings->getFactionControl(i) == ctNetwork && settings->getThisFactionIndex() == i)){ + vector 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 loadScreenList; + findAll(path + "/" + "loading_screen.*", 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] looking for loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str()); + + if(fileExists(factionLogo) == true) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str()); + + result = factionLogo; + if(logger != NULL) { + logger->loadLoadingScreen(result); + } + loadingImageUsed = true; + break; + } + } + } + + if(loadingImageUsed == true) { + break; + } + } + break; + } + } + } + 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__); + + vector 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()); + if(isdir(path.c_str()) == true) { + vector loadScreenList; + findAll(path + "/" + "loading_screen.*", 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] looking for loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str()); + + if(fileExists(factionLogo) == true) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] found loading screen '%s'\n",__FILE__,__FUNCTION__,factionLogo.c_str()); + + result = factionLogo; + if(logger != NULL) { + logger->loadLoadingScreen(result); + } + loadingImageUsed = true; + break; + } + } + } + if(loadingImageUsed == true) { + break; + } + } + } + + return result; +} + void Game::load(){ originalDisplayMsgCallback = NetworkInterface::getDisplayMessageFunction(); NetworkInterface::setDisplayMessageFunction(ErrorDisplayMessage); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] gameSettings = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->gameSettings.toString().c_str()); + Config &config = Config::getInstance(); Logger &logger= Logger::getInstance(); + Game::findFactionLogoFile(&gameSettings, &logger); + string mapName= gameSettings.getMap(); string tilesetName= gameSettings.getTileset(); string techName= gameSettings.getTech(); string scenarioName= gameSettings.getScenario(); + + string scenarioDir = ""; + if(gameSettings.getScenarioDir() != "") { + scenarioDir = gameSettings.getScenarioDir(); + if(EndsWith(scenarioDir, ".xml") == true) { + scenarioDir = scenarioDir.erase(scenarioDir.size() - 4, 4); + scenarioDir = scenarioDir.erase(scenarioDir.size() - gameSettings.getScenario().size(), gameSettings.getScenario().size() + 1); + } + } + +/* bool loadingImageUsed=false; logger.setState(Lang::getInstance().get("Loading")); @@ -276,7 +427,7 @@ void Game::load(){ } } } - +*/ //throw runtime_error("Test!"); SDL_PumpEvents(); diff --git a/source/glest_game/game/game.h b/source/glest_game/game/game.h index b4a43130..b74f5535 100644 --- a/source/glest_game/game/game.h +++ b/source/glest_game/game/game.h @@ -143,6 +143,8 @@ public: void endPerformanceTimer(); Vec2i getPerformanceTimerResults(); + static string findFactionLogoFile(const GameSettings *settings, Logger *logger); + private: //render void render3d(); diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 371b668d..4353fb81 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -736,7 +736,7 @@ void Renderer::renderMouse3d() { } -void Renderer::renderBackground(const Texture2D *texture){ +void Renderer::renderBackground(const Texture2D *texture) { const Metrics &metrics= Metrics::getInstance(); diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index d578a8e6..cb2e6285 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -50,6 +50,10 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM { switchSetupRequestFlagType |= ssrft_NetworkPlayerName; updateDataSynchDetailText = false; + + currentFactionLogo = ""; + factionTexture=NULL; + activeInputLabel = NULL; lastNetworkSendPing = 0; pingCount = 0; @@ -183,7 +187,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); //list boxes - xoffset=120; + xoffset=60; int rowHeight=27; for(int i=0; igetAllowGameDataSynchCheck() == false); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); vector maps,tilesets,techtree; - const GameSettings *gameSettings=clientInterface->getGameSettings(); + const GameSettings *gameSettings = clientInterface->getGameSettings(); if(gameSettings == NULL) { throw runtime_error("gameSettings == NULL"); @@ -784,6 +795,16 @@ void MenuStateConnectedGame::update() { mustSwitchPlayerName = true; } } + + if( clientInterface != NULL && clientInterface->isConnected() && + gameSettings != NULL) { + + string factionLogo = Game::findFactionLogoFile(gameSettings, NULL); + if(currentFactionLogo != factionLogo) { + currentFactionLogo = factionLogo; + loadFactionTexture(currentFactionLogo); + } + } } //update lobby @@ -834,6 +855,7 @@ void MenuStateConnectedGame::update() { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); program->setState(new Game(program, clientInterface->getGameSettings())); + return; SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); } @@ -1092,4 +1114,51 @@ string MenuStateConnectedGame::getHumanPlayerName() { return result; } +void MenuStateConnectedGame::loadFactionTexture(string filepath) { + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + + cleanupFactionTexture(); + + if(filepath=="") + { + factionTexture=NULL; + } + else + { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] filepath = [%s]\n",__FILE__,__FUNCTION__,__LINE__,filepath.c_str()); + + factionTexture = GraphicsInterface::getInstance().getFactory()->newTexture2D(); + //loadingTexture = renderer.newTexture2D(rsGlobal); + factionTexture->setMipmap(true); + //loadingTexture->getPixmap()->load(filepath); + factionTexture->load(filepath); + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + + Renderer &renderer= Renderer::getInstance(); + renderer.initTexture(rsGlobal,factionTexture); + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + } +} + +void MenuStateConnectedGame::cleanupFactionTexture() { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + + if(factionTexture!=NULL) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + + factionTexture->end(); + delete factionTexture; + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + + //delete loadingTexture; + factionTexture=NULL; + } + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); +} + }}//end namespace diff --git a/source/glest_game/menu/menu_state_connected_game.h b/source/glest_game/menu/menu_state_connected_game.h index e1f35f40..58bb3665 100644 --- a/source/glest_game/menu/menu_state_connected_game.h +++ b/source/glest_game/menu/menu_state_connected_game.h @@ -109,8 +109,12 @@ private: int8 switchSetupRequestFlagType; string defaultPlayerName; + string currentFactionLogo; + Texture2D *factionTexture; + public: MenuStateConnectedGame(Program *program, MainMenu *mainMenu, JoinMenu joinMenuInfo=jmSimple, bool openNetworkSlots= false); + ~MenuStateConnectedGame(); void mouseClick(int x, int y, MouseButton mouseButton); void mouseMove(int x, int y, const MouseState *mouseState); @@ -131,6 +135,10 @@ private: void returnToJoinMenu(); string getHumanPlayerName(); void setActiveInputLabel(GraphicLabel *newLable); + + void cleanupFactionTexture(); + void loadFactionTexture(string filepath); + }; }}//end namespace diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index b39d02bf..9e09d43b 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -53,6 +53,8 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b activeInputLabel=NULL; showGeneralError = false; generalErrorToShow = "---"; + currentFactionLogo = ""; + factionTexture=NULL; publishToMasterserverThread = NULL; Lang &lang= Lang::getInstance(); @@ -231,9 +233,9 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b // Advanced Options - labelAdvanced.init(790, 80, 80); + labelAdvanced.init(xoffset+650, 150, 80); labelAdvanced.setText(lang.get("AdvancedGameOptions")); - listBoxAdvanced.init(810, 80-30, 80); + listBoxAdvanced.init(xoffset+650, 150-30, 80); listBoxAdvanced.pushBackItem(lang.get("Yes")); listBoxAdvanced.pushBackItem(lang.get("No")); listBoxAdvanced.setSelectedItemIndex(0); @@ -296,16 +298,16 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b listBoxEnableServerControlledAI.setSelectedItemIndex(0); //list boxes - xoffset=120; + xoffset=60; int rowHeight=27; for(int i=0; isetGameSettings(&gameSettings,true); - needToSetChangedGameSettings = false; - lastSetChangedGameSettings = time(NULL); - } - - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); - bool bOkToStart = serverInterface->launchGame(&gameSettings); - if(bOkToStart == true) { - if( listBoxPublishServer.getEditable() && - listBoxPublishServer.getSelectedItemIndex() == 0) { + bool dataSynchCheckOk = true; + for(int i= 0; igetSlot(i); + if(connectionSlot != NULL && connectionSlot->getNetworkGameDataSynchCheckOk() == false) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); + dataSynchCheckOk = false; + break; + } } - needToBroadcastServerSettings = false; - needToRepublishToMasterserver = false; + } + + if(dataSynchCheckOk == false) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); + mainMessageBoxState=1; + showMessageBox( "You cannot start the game because\none or more clients do not have the same game data!", "Data Mismatch Error", false); + safeMutex.ReleaseLock(); - - delete publishToMasterserverThread; - publishToMasterserverThread = NULL; - - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); - - assert(program != NULL); - - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); - program->setState(new Game(program, &gameSettings)); + return; } else { - safeMutex.ReleaseLock(); + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); + if( hasNetworkGameSettings() == true && + needToSetChangedGameSettings == true) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); + serverInterface->setGameSettings(&gameSettings,true); + + needToSetChangedGameSettings = false; + lastSetChangedGameSettings = time(NULL); + } + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); + bool bOkToStart = serverInterface->launchGame(&gameSettings); + if(bOkToStart == true) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); + + if( listBoxPublishServer.getEditable() && + listBoxPublishServer.getSelectedItemIndex() == 0) { + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); + + needToRepublishToMasterserver = true; + lastMasterserverPublishing = 0; + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); + } + needToBroadcastServerSettings = false; + needToRepublishToMasterserver = false; + safeMutex.ReleaseLock(); + + delete publishToMasterserverThread; + publishToMasterserverThread = NULL; + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); + + assert(program != NULL); + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); + program->setState(new Game(program, &gameSettings)); + return; + } + else { + safeMutex.ReleaseLock(); + } } SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); @@ -824,10 +860,14 @@ void MenuStateCustomGame::mouseMove(int x, int y, const MouseState *ms){ listBoxAdvanced.mouseMove(x, y); } -void MenuStateCustomGame::render(){ +void MenuStateCustomGame::render() { try { Renderer &renderer= Renderer::getInstance(); + if(factionTexture != NULL) { + renderer.renderTextureQuad(60+575+40,365,200,225,factionTexture,1); + } + if(mainMessageBox.getEnabled()){ renderer.renderMessageBox(&mainMessageBox); } @@ -1057,7 +1097,9 @@ void MenuStateCustomGame::update() { currentConnectionCount++; //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] B - ctNetwork\n",__FILE__,__FUNCTION__); - string label = connectionSlot->getName() + ", " + connectionSlot->getVersionString(); + //string label = connectionSlot->getName() + ", " + connectionSlot->getVersionString(); + string label = connectionSlot->getVersionString(); + if(connectionSlot != NULL && connectionSlot->getAllowDownloadDataSynch() == true && connectionSlot->getAllowGameDataSynchCheck() == true) @@ -1184,11 +1226,11 @@ void MenuStateCustomGame::update() { needToSetChangedGameSettings == true && difftime(time(NULL),lastSetChangedGameSettings) >= 2); + GameSettings gameSettings; + loadGameSettings(&gameSettings); + // Send the game settings to each client if we have at least one networked client - if(checkDataSynch == true) - { - GameSettings gameSettings; - loadGameSettings(&gameSettings); + if(checkDataSynch == true) { serverInterface->setGameSettings(&gameSettings,false); needToSetChangedGameSettings = false; } @@ -1251,6 +1293,12 @@ void MenuStateCustomGame::update() { } soundConnectionCount = currentConnectionCount; + string factionLogo = Game::findFactionLogoFile(&gameSettings, NULL); + if(currentFactionLogo != factionLogo) { + currentFactionLogo = factionLogo; + loadFactionTexture(currentFactionLogo); + } + //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); } catch(const std::exception &ex) { @@ -2066,4 +2114,51 @@ string MenuStateCustomGame::getHumanPlayerName(int index) { return result; } +void MenuStateCustomGame::loadFactionTexture(string filepath) { + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + + cleanupFactionTexture(); + + if(filepath=="") + { + factionTexture=NULL; + } + else + { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] filepath = [%s]\n",__FILE__,__FUNCTION__,__LINE__,filepath.c_str()); + + factionTexture = GraphicsInterface::getInstance().getFactory()->newTexture2D(); + //loadingTexture = renderer.newTexture2D(rsGlobal); + factionTexture->setMipmap(true); + //loadingTexture->getPixmap()->load(filepath); + factionTexture->load(filepath); + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + + Renderer &renderer= Renderer::getInstance(); + renderer.initTexture(rsGlobal,factionTexture); + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + } +} + +void MenuStateCustomGame::cleanupFactionTexture() { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + + if(factionTexture!=NULL) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + + factionTexture->end(); + delete factionTexture; + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); + + //delete loadingTexture; + factionTexture=NULL; + } + + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); +} + }}//end namespace diff --git a/source/glest_game/menu/menu_state_custom_game.h b/source/glest_game/menu/menu_state_custom_game.h index e21d826b..ff50e789 100644 --- a/source/glest_game/menu/menu_state_custom_game.h +++ b/source/glest_game/menu/menu_state_custom_game.h @@ -118,6 +118,9 @@ private: string defaultPlayerName; int8 switchSetupRequestFlagType; + string currentFactionLogo; + Texture2D *factionTexture; + public: MenuStateCustomGame(Program *program, MainMenu *mainMenu ,bool openNetworkSlots= false, bool parentMenuIsMasterserver=false); ~MenuStateCustomGame(); @@ -154,6 +157,9 @@ private: GameSettings loadGameSettingsFromFile(std::string fileName); void setActiveInputLabel(GraphicLabel *newLable); string getHumanPlayerName(int index=-1); + + void cleanupFactionTexture(); + void loadFactionTexture(string filepath); }; }}//end namespace