summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-11 18:58:18 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-11 19:11:45 +0300
commit85576f6d4fa83a0151ea08e2684f7babdfcfc707 (patch)
treea152a34c6bef6734ac63d251bc638004f11565a7 /src/game.cpp
parent37eac088655e2d4f5cd9e511058eead078bbf497 (diff)
downloadplus-85576f6d4fa83a0151ea08e2684f7babdfcfc707.tar.gz
plus-85576f6d4fa83a0151ea08e2684f7babdfcfc707.tar.bz2
plus-85576f6d4fa83a0151ea08e2684f7babdfcfc707.tar.xz
plus-85576f6d4fa83a0151ea08e2684f7babdfcfc707.zip
Allow set image name prefix in chat command /screenshot.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp13
1 files changed, 8 insertions, 5 deletions
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);
}