mirror of
https://github.com/glest/glest-source.git
synced 2025-09-02 20:42:34 +02:00
attempt bugfix for bad screenshots on saved games
This commit is contained in:
@@ -268,11 +268,13 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
if(slots[i]->mouseClick(x, y) && selectedButton != slots[i]) {
|
if(slots[i]->mouseClick(x, y) && selectedButton != slots[i]) {
|
||||||
soundRenderer.playFx(coreData.getClickSoundB());
|
soundRenderer.playFx(coreData.getClickSoundB());
|
||||||
|
|
||||||
|
Lang &lang= Lang::getInstance();
|
||||||
cleanupTexture(&previewTexture);
|
cleanupTexture(&previewTexture);
|
||||||
selectedButton = slots[i];
|
selectedButton = slots[i];
|
||||||
string filename = saveGameDir + selectedButton->getText()+".xml";
|
string filename = saveGameDir + selectedButton->getText()+".xml";
|
||||||
string screenShotFilename = filename + ".jpg";
|
string screenShotFilename = filename + ".jpg";
|
||||||
if(fileExists(screenShotFilename) == true) {
|
if(fileExists(screenShotFilename) == true) {
|
||||||
|
try {
|
||||||
previewTexture = GraphicsInterface::getInstance().getFactory()->newTexture2D();
|
previewTexture = GraphicsInterface::getInstance().getFactory()->newTexture2D();
|
||||||
if(previewTexture) {
|
if(previewTexture) {
|
||||||
previewTexture->setMipmap(true);
|
previewTexture->setMipmap(true);
|
||||||
@@ -280,13 +282,16 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
previewTexture->init();
|
previewTexture->init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch(const megaglest_runtime_error &ex) {
|
||||||
|
cleanupTexture(&previewTexture);
|
||||||
|
showMessageBox(ex.what(), lang.getString("Notice"), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
previewTexture=NULL;
|
previewTexture=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fileExists(filename) == true) {
|
if(fileExists(filename) == true) {
|
||||||
Lang &lang= Lang::getInstance();
|
|
||||||
|
|
||||||
// Xerces is infinitely slower than rapidxml
|
// Xerces is infinitely slower than rapidxml
|
||||||
// XmlTree xmlTree(XML_XERCES_ENGINE);
|
// XmlTree xmlTree(XML_XERCES_ENGINE);
|
||||||
XmlTree xmlTree(XML_RAPIDXML_ENGINE);
|
XmlTree xmlTree(XML_RAPIDXML_ENGINE);
|
||||||
|
Reference in New Issue
Block a user