changeset 13557:b25cd3063c06 draft

(svn r18079) -Codechange: allow overwriting of screenshots with user-supplied filenames
author smatz <smatz@openttd.org>
date Sat, 14 Nov 2009 15:50:38 +0000
parents e7121cbd5f5a
children 08924de14d5f
files src/screenshot.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -571,7 +571,9 @@
 
 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 @@
 			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);