summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-11-14 15:50:38 +0000
committersmatz <smatz@openttd.org>2009-11-14 15:50:38 +0000
commit28916ca39e47751c7b2c968da50bce02207c3643 (patch)
treec30f8e03b914533c6888c7b6767b113c4a1d199e /src
parent16c2e53191f0d6bc303a87651eb5bac8ed06dac5 (diff)
downloadopenttd-28916ca39e47751c7b2c968da50bce02207c3643.tar.xz
(svn r18079) -Codechange: allow overwriting of screenshots with user-supplied filenames
Diffstat (limited to 'src')
-rw-r--r--src/screenshot.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index 4f9ab46ab..542406a0d 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -571,7 +571,9 @@ static void LargeWorldCallback(void *userdata, void *buf, uint y, uint pitch, ui
static const char *MakeScreenshotName(const char *ext)
{
- if (_screenshot_name[0] == '\0') {
+ bool generate = StrEmpty(_screenshot_name);
+
+ if (generate) {
if (_game_mode == GM_EDITOR || _game_mode == GM_MENU || _local_company == COMPANY_SPECTATOR) {
strecpy(_screenshot_name, "screenshot", lastof(_screenshot_name));
} else {
@@ -590,6 +592,7 @@ static const char *MakeScreenshotName(const char *ext)
filename[0] = '\0';
break;
}
+ if (!generate) break; // allow overwriting of non-automatic filenames
if (!FileExists(filename)) break;
/* If file exists try another one with same name, but just with a higher index */
snprintf(&_screenshot_name[len], lengthof(_screenshot_name) - len, "#%u.%s", serial, ext);