From 7d9e47ef071fc9d12455d24031e4012ba6def069 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Sun, 1 Apr 2007 15:32:26 +0000 Subject: Screenshots are no longer saved directly in the users home directory on UNIX systems but in the sub folder /.tmw/. A chatlog message about the success of the screenshot saving does appear now. Based on a patch by Patrick "the-me" Matthäi. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 9 ++++++++- src/game.cpp | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc0341d5..0b459924 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ -2007-03-27 Bjørn Lindeijer +2007-04-01 Philipp Sehmisch + + * src/game.cpp: Screenshots are no longer saved directly in the users + home directory on UNIX systems but in the sub folder /.tmw/. A chatlog + message about the success of the screenshot saving does appear now. Based + on a patch by Patrick "the-me" Matthäi. + +2007-03-27 Bjørn Lindeijer * src/main.cpp: Icon loading doesn't necessarily succeed, so better not crash when it doesn't. diff --git a/src/game.cpp b/src/game.cpp index 6052cf48..ddd1266c 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -307,6 +307,7 @@ bool saveScreenshot(SDL_Surface *screenshot) // Search for an unused screenshot name std::stringstream filename; + std::stringstream chatlogentry; std::fstream testExists; bool found = false; @@ -314,7 +315,7 @@ bool saveScreenshot(SDL_Surface *screenshot) screenshotCount++; filename.str(""); #if (defined __USE_UNIX98 || defined __FreeBSD__) - filename << PHYSFS_getUserDir() << "/"; + filename << PHYSFS_getUserDir() << ".tmw/"; #endif filename << "TMW_Screenshot_" << screenshotCount << ".png"; testExists.open(filename.str().c_str(), std::ios::in); @@ -322,7 +323,18 @@ bool saveScreenshot(SDL_Surface *screenshot) testExists.close(); } while (!found); - return ImageWriter::writePNG(screenshot, filename.str()); + if (ImageWriter::writePNG(screenshot, filename.str())) + { + chatlogentry << "Screenshot saved to " << filename.str().c_str(); + chatWindow->chatLog(chatlogentry.str(), BY_SERVER); + return true; + } + else + { + chatlogentry << "Saving screenshot failed!"; + chatWindow->chatLog(chatlogentry.str(), BY_SERVER); + return false; + } } void Game::optionChanged(const std::string &name) -- cgit v1.2.3-70-g09d2