diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-13 20:46:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-13 20:46:44 +0300 |
commit | 9f2b625b1d5832d8e7c51f0cc3e61a2e90effd0c (patch) | |
tree | 2b920712a112e48b309482766d32d1861778d087 /src/game.cpp | |
parent | 28e49f0cc48d48bf27fde2deacabb85b90a7352f (diff) | |
download | manaplus-9f2b625b1d5832d8e7c51f0cc3e61a2e90effd0c.tar.gz manaplus-9f2b625b1d5832d8e7c51f0cc3e61a2e90effd0c.tar.bz2 manaplus-9f2b625b1d5832d8e7c51f0cc3e61a2e90effd0c.tar.xz manaplus-9f2b625b1d5832d8e7c51f0cc3e61a2e90effd0c.zip |
allow create screenshot before connecting to game.
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/game.cpp b/src/game.cpp index a2f389626..8d11d222c 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -488,9 +488,12 @@ Game::~Game() bool Game::createScreenshot() { + if (!mainGraphics) + return false; + SDL_Surface *screenshot = nullptr; - if (!config.getBoolValue("showip")) + if (!config.getBoolValue("showip") && gui) { mainGraphics->setSecure(true); mainGraphics->prepareScreenshot(); @@ -512,7 +515,6 @@ bool Game::createScreenshot() bool Game::saveScreenshot(SDL_Surface *const screenshot) { std::string screenshotDirectory = client->getScreenshotDirectory(); - if (mkdir_r(screenshotDirectory.c_str()) != 0) { logger->log("Directory %s doesn't exist and can't be created! " @@ -554,12 +556,14 @@ bool Game::saveScreenshot(SDL_Surface *const screenshot) if (success) { - std::stringstream chatlogentry; - // TRANSLATORS: save file message - chatlogentry << strprintf(_("Screenshot saved as %s"), - filenameSuffix.str().c_str()); if (localChatTab) - localChatTab->chatLog(chatlogentry.str(), BY_SERVER); + { + std::stringstream chatlogentry; + // TRANSLATORS: save file message + std::string str = strprintf(_("Screenshot saved as %s"), + filenameSuffix.str().c_str()); + localChatTab->chatLog(str, BY_SERVER); + } } else { @@ -573,7 +577,6 @@ bool Game::saveScreenshot(SDL_Surface *const screenshot) } MSDL_FreeSurface(screenshot); - return success; } |