Commit 80fce5e2 authored by Robert Sprowson's avatar Robert Sprowson Committed by ROOL
Browse files

[546] Don't hide 'Bad sprite file' errors

Rather than use wimpt_complain for those SpriteOps involved in loading a file (which leads to a 'Paint has gone wrong' style error box), use werr tp show the message in one step.
parent f3772a07
......@@ -72,6 +72,7 @@
#include "Global/FileTypes.h"
#include "Global/OsBytes.h"
#include "Global/VduExt.h"
#include "Global/Sprite.h"
#include "pointer.h"
#include "akbd.h"
......@@ -1420,6 +1421,7 @@ int Load_File (main_window *window, char *filename, int merge,
sprite_size,
log2_bpp = bbc_modevar (-1, bbc_Log2BPP);
os_filestr filestr;
os_error *err;
main_sprite *sprite, **sprptr;
sprite_header *header;
main_file *file;
......@@ -1520,9 +1522,10 @@ int Load_File (main_window *window, char *filename, int merge,
*(int *) ramfetch_buffer = sprite_size + sizeof (sprite_area);
/* convert into sprite area */
if (wimpt_complain (sprite_area_load
((sprite_area *) ramfetch_buffer, filename)))
{ flex_free ((flex_ptr) &ramfetch_buffer);
err = sprite_area_load ((sprite_area *) ramfetch_buffer, filename);
if (err)
{ werr (FALSE, err->errmess);
flex_free ((flex_ptr) &ramfetch_buffer);
return -1;
}
}
......@@ -1580,8 +1583,9 @@ int Load_File (main_window *window, char *filename, int merge,
/* convert into sprite area */
ftracef0 ("verify area ...\n"); /*J R C 18th Nov 1994*/
if (wimpt_complain (os_swix2 (OS_SpriteOp, 512 | 17, ramfetch_buffer)))
{ ftracef0 ("area invalid\n");
err = os_swix2 (OS_SpriteOp, 512 | SpriteReason_CheckSpriteArea, ramfetch_buffer);
if (err)
{ werr (FALSE, err->errmess);
return NULL;
}
ftracef0 ("area valid\n");
......@@ -1604,12 +1608,13 @@ int Load_File (main_window *window, char *filename, int merge,
ftracef2 ("Load_File: loading \"%s\" into area 0x%X\n",
filename, file->spritearea);
if (file_type == FileType_Sprite)
{ if (wimpt_complain (sprite_area_load (file->spritearea, filename)))
return NULL;
ftracef0 ("verify area ...\n"); /*J R C 7th Nov 1994*/
if (wimpt_complain (os_swix2 (OS_SpriteOp, 512 | 17, file->spritearea)))
{ ftracef0 ("area invalid\n");
{ err = sprite_area_load (file->spritearea, filename);
if (!err)
{ ftracef0 ("verify area ...\n"); /*J R C 7th Nov 1994*/
err = os_swix2 (OS_SpriteOp, 512 | SpriteReason_CheckSpriteArea, file->spritearea);
}
if (err)
{ werr (FALSE, err->errmess);
return NULL;
}
ftracef0 ("area valid\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment