From 28e49f0cc48d48bf27fde2deacabb85b90a7352f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 13 Jan 2014 14:22:59 +0300 Subject: Show date and time in screenshots name. --- src/game.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/game.cpp') 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(); -- cgit v1.2.3-70-g09d2