From 85576f6d4fa83a0151ea08e2684f7babdfcfc707 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 11 May 2017 18:58:18 +0300 Subject: Allow set image name prefix in chat command /screenshot. --- src/game.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index cf58a1930..cf43d4ea4 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -498,7 +498,7 @@ void Game::addWatermark() 100, 50); } -bool Game::createScreenshot() +bool Game::createScreenshot(const std::string &prefix) { if (!mainGraphics || !screenshortHelper) return false; @@ -523,10 +523,11 @@ bool Game::createScreenshot() if (!screenshot) return false; - return saveScreenshot(screenshot); + return saveScreenshot(screenshot, prefix); } -bool Game::saveScreenshot(SDL_Surface *const screenshot) +bool Game::saveScreenshot(SDL_Surface *const screenshot, + const std::string &prefix) { std::string screenshotDirectory = settings.screenshotDir; if (mkdir_r(screenshotDirectory.c_str()) != 0) @@ -553,13 +554,15 @@ bool Game::saveScreenshot(SDL_Surface *const screenshot) std::string screenShortStr; if (serverName.empty()) { - screenShortStr = strprintf("%s_Screenshot_%s_", + screenShortStr = strprintf("%s%s_Screenshot_%s_", + prefix.c_str(), branding.getValue("appName", "ManaPlus").c_str(), buffer); } else { - screenShortStr = strprintf("%s_Screenshot_%s_%s_", + screenShortStr = strprintf("%s%s_Screenshot_%s_%s_", + prefix.c_str(), branding.getValue("appName", "ManaPlus").c_str(), serverName.c_str(), buffer); } -- cgit v1.2.3-60-g2f50