Changeset - r13547:de678555e750
[Not reviewed]
master
0 1 0
smatz - 15 years ago 2009-11-14 15:50:38
smatz@openttd.org
(svn r18079) -Codechange: allow overwriting of screenshots with user-supplied filenames
1 file changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/screenshot.cpp
Show inline comments
 
@@ -571,7 +571,9 @@ static void LargeWorldCallback(void *use
 

	
 
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(co
 
			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);
0 comments (0 inline, 0 general)