diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-13 14:22:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-13 14:22:59 +0300 |
commit | 28e49f0cc48d48bf27fde2deacabb85b90a7352f (patch) | |
tree | 1c10d4076e9b0fc5c108dcc819c62b417a129173 | |
parent | a0618292425d9064fce1f36182c005eb2c09943a (diff) | |
download | manaverse-28e49f0cc48d48bf27fde2deacabb85b90a7352f.tar.gz manaverse-28e49f0cc48d48bf27fde2deacabb85b90a7352f.tar.bz2 manaverse-28e49f0cc48d48bf27fde2deacabb85b90a7352f.tar.xz manaverse-28e49f0cc48d48bf27fde2deacabb85b90a7352f.zip |
Show date and time in screenshots name.
-rw-r--r-- | src/game.cpp | 12 |
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(); |