(svn r18630) -Fix [FS#3419]: when making a screenshot the name of the previous screenshot went missing in the 'successful screenshot' message

This commit is contained in:
rubidium 2009-12-25 19:16:58 +00:00
parent 6cf4637dac
commit 21a3f97a0b
2 changed files with 10 additions and 5 deletions

View File

@ -30,7 +30,7 @@
char _screenshot_format_name[8]; char _screenshot_format_name[8];
uint _num_screenshot_formats; uint _num_screenshot_formats;
uint _cur_screenshot_format; uint _cur_screenshot_format;
char _screenshot_name[128]; static char _screenshot_name[128];
char _full_screenshot_name[MAX_PATH]; char _full_screenshot_name[MAX_PATH];
/* called by the ScreenShot proc to generate screenshot lines. */ /* called by the ScreenShot proc to generate screenshot lines. */
@ -636,15 +636,21 @@ static bool MakeWorldScreenshot()
*/ */
bool MakeScreenshot(ScreenshotType t, const char *name) 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'; _screenshot_name[0] = '\0';
if (name != NULL) strecpy(_screenshot_name, name, lastof(_screenshot_name)); if (name != NULL) strecpy(_screenshot_name, name, lastof(_screenshot_name));
bool ret; bool ret;
switch (t) { switch (t) {
case SC_VIEWPORT: case SC_VIEWPORT:
UndrawMouseCursor();
DrawDirtyBlocks();
/* FALL THROUGH */
case SC_RAW: case SC_RAW:
ret = MakeSmallScreenshot(); ret = MakeSmallScreenshot();
break; break;

View File

@ -29,7 +29,6 @@ bool MakeScreenshot(ScreenshotType t, const char *name);
extern char _screenshot_format_name[8]; extern char _screenshot_format_name[8];
extern uint _num_screenshot_formats; extern uint _num_screenshot_formats;
extern uint _cur_screenshot_format; extern uint _cur_screenshot_format;
extern char _screenshot_name[128];
extern char _full_screenshot_name[MAX_PATH]; extern char _full_screenshot_name[MAX_PATH];
#endif /* SCREENSHOT_H */ #endif /* SCREENSHOT_H */