summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-13 14:22:59 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-13 14:22:59 +0300
commit28e49f0cc48d48bf27fde2deacabb85b90a7352f (patch)
tree1c10d4076e9b0fc5c108dcc819c62b417a129173 /src
parenta0618292425d9064fce1f36182c005eb2c09943a (diff)
downloadplus-28e49f0cc48d48bf27fde2deacabb85b90a7352f.tar.gz
plus-28e49f0cc48d48bf27fde2deacabb85b90a7352f.tar.bz2
plus-28e49f0cc48d48bf27fde2deacabb85b90a7352f.tar.xz
plus-28e49f0cc48d48bf27fde2deacabb85b90a7352f.zip
Show date and time in screenshots name.
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 52c348a7e..a2f389626 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -527,14 +527,22 @@ bool Game::saveScreenshot(SDL_Surface *const screenshot)
std::fstream testExists;
bool found = false;
static unsigned int screenshotCount = 0;
+
+ time_t rawtime;
+ char buffer [100];
+ time(&rawtime);
+ struct tm *const timeinfo = localtime(&rawtime);
+ strftime(buffer, 99, "%Y-%m-%d_%H-%M-%S", timeinfo);
+
+ const std::string screenShortStr = strprintf("%s_Screenshot_%s_",
+ branding.getValue("appName", "ManaPlus").c_str(), buffer);
do
{
screenshotCount++;
filenameSuffix.str("");
filename.str("");
filename << screenshotDirectory << "/";
- filenameSuffix << branding.getValue("appName", "ManaPlus")
- << "_Screenshot_" << screenshotCount << ".png";
+ filenameSuffix << screenShortStr << screenshotCount << ".png";
filename << filenameSuffix.str();
testExists.open(filename.str().c_str(), std::ios::in);
found = !testExists.is_open();