summaryrefslogtreecommitdiff
path: root/src/game.cpp
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 /src/game.cpp
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.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp16
1 files changed, 14 insertions, 2 deletions
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)