summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-13 20:46:44 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-13 20:46:44 +0300
commit9f2b625b1d5832d8e7c51f0cc3e61a2e90effd0c (patch)
tree2b920712a112e48b309482766d32d1861778d087 /src
parent28e49f0cc48d48bf27fde2deacabb85b90a7352f (diff)
downloadplus-9f2b625b1d5832d8e7c51f0cc3e61a2e90effd0c.tar.gz
plus-9f2b625b1d5832d8e7c51f0cc3e61a2e90effd0c.tar.bz2
plus-9f2b625b1d5832d8e7c51f0cc3e61a2e90effd0c.tar.xz
plus-9f2b625b1d5832d8e7c51f0cc3e61a2e90effd0c.zip
allow create screenshot before connecting to game.
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp19
-rw-r--r--src/input/keyboarddata.h2
2 files changed, 12 insertions, 9 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;
}
diff --git a/src/input/keyboarddata.h b/src/input/keyboarddata.h
index 0de9c871e..da0d22fee 100644
--- a/src/input/keyboarddata.h
+++ b/src/input/keyboarddata.h
@@ -187,7 +187,7 @@ static const KeyData keyData[Input::KEY_TOTAL] = {
Input::GRP_DEFAULT,
&ActionManager::screenshot,
Input::KEY_NO_VALUE, 50,
- COND_GAME | COND_NOTARGET},
+ COND_NOTARGET},
{"keyTrade",
INPUT_KEYBOARD, SDLK_r,
INPUT_UNKNOWN, Input::KEY_NO_VALUE,