attempt bugfix for bad screenshots on saved games

This commit is contained in:
Mark Vejvoda 2013-11-13 23:37:12 +00:00
parent 1067e89915
commit 0bc9ed082f
1 changed files with 12 additions and 7 deletions

View File

@ -268,16 +268,23 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
if(slots[i]->mouseClick(x, y) && selectedButton != slots[i]) {
soundRenderer.playFx(coreData.getClickSoundB());
Lang &lang= Lang::getInstance();
cleanupTexture(&previewTexture);
selectedButton = slots[i];
string filename = saveGameDir + selectedButton->getText()+".xml";
string screenShotFilename = filename + ".jpg";
if(fileExists(screenShotFilename) == true) {
previewTexture = GraphicsInterface::getInstance().getFactory()->newTexture2D();
if(previewTexture) {
previewTexture->setMipmap(true);
previewTexture->load(screenShotFilename);
previewTexture->init();
try {
previewTexture = GraphicsInterface::getInstance().getFactory()->newTexture2D();
if(previewTexture) {
previewTexture->setMipmap(true);
previewTexture->load(screenShotFilename);
previewTexture->init();
}
}
catch(const megaglest_runtime_error &ex) {
cleanupTexture(&previewTexture);
showMessageBox(ex.what(), lang.getString("Notice"), true);
}
}
else {
@ -285,8 +292,6 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
}
if(fileExists(filename) == true) {
Lang &lang= Lang::getInstance();
// Xerces is infinitely slower than rapidxml
// XmlTree xmlTree(XML_XERCES_ENGINE);
XmlTree xmlTree(XML_RAPIDXML_ENGINE);