summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2007-04-01 15:32:26 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2007-04-01 15:32:26 +0000
commit7d9e47ef071fc9d12455d24031e4012ba6def069 (patch)
tree11719371469da53ececdc75928b72fa42255e260
parent75ecd3b04df947ba1ac489f60933f18686b62ec1 (diff)
downloadmana-7d9e47ef071fc9d12455d24031e4012ba6def069.tar.gz
mana-7d9e47ef071fc9d12455d24031e4012ba6def069.tar.bz2
mana-7d9e47ef071fc9d12455d24031e4012ba6def069.tar.xz
mana-7d9e47ef071fc9d12455d24031e4012ba6def069.zip
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.
-rw-r--r--ChangeLog9
-rw-r--r--src/game.cpp16
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 <bjorn@lindeijer.nl>
+2007-04-01 Philipp Sehmisch <tmw@crushnet.org>
+
+ * 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 <bjorn@lindeijer.nl>
* 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)