summaryrefslogtreecommitdiff
path: root/src/screenshot.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-25 19:16:58 +0000
committerrubidium <rubidium@openttd.org>2009-12-25 19:16:58 +0000
commit21a3f97a0b22ac7e4cc6849bfd05fa215efa862c (patch)
tree6182469e0852f7d341cd7f8066e792bf746a2e84 /src/screenshot.cpp
parent6cf4637dac09a34ff5287e3a097e1cd17d817fc9 (diff)
downloadopenttd-21a3f97a0b22ac7e4cc6849bfd05fa215efa862c.tar.xz
(svn r18630) -Fix [FS#3419]: when making a screenshot the name of the previous screenshot went missing in the 'successful screenshot' message
Diffstat (limited to 'src/screenshot.cpp')
-rw-r--r--src/screenshot.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index 329ed0160..5ef812695 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -30,7 +30,7 @@
char _screenshot_format_name[8];
uint _num_screenshot_formats;
uint _cur_screenshot_format;
-char _screenshot_name[128];
+static char _screenshot_name[128];
char _full_screenshot_name[MAX_PATH];
/* called by the ScreenShot proc to generate screenshot lines. */
@@ -636,15 +636,21 @@ static bool MakeWorldScreenshot()
*/
bool MakeScreenshot(ScreenshotType t, const char *name)
{
+ if (t == SC_VIEWPORT) {
+ /* First draw the dirty parts of the screen and only then change the name
+ * of the screenshot. This way the screenshot will always show the name
+ * of the previous screenshot in the 'succesful' message instead of the
+ * name of the new screenshot (or an empty name). */
+ UndrawMouseCursor();
+ DrawDirtyBlocks();
+ }
+
_screenshot_name[0] = '\0';
if (name != NULL) strecpy(_screenshot_name, name, lastof(_screenshot_name));
bool ret;
switch (t) {
case SC_VIEWPORT:
- UndrawMouseCursor();
- DrawDirtyBlocks();
- /* FALL THROUGH */
case SC_RAW:
ret = MakeSmallScreenshot();
break;