Add indication of offending cell in C64 formats
This commit is contained in:
parent
48a8a79746
commit
7059271965
@ -2831,9 +2831,8 @@ int Save_C64_hires(T_IO_Context *context, char *filename, byte saveWhat, byte lo
|
|||||||
numcolors=Count_used_colors_area(cusage,cx*8,cy*8,8,8);
|
numcolors=Count_used_colors_area(cusage,cx*8,cy*8,8,8);
|
||||||
if (numcolors>2)
|
if (numcolors>2)
|
||||||
{
|
{
|
||||||
Warning_message("More than 2 colors in 8x8 pixels");
|
Warning_with_format("More than 2 colors\nin 8x8 pixel cell: (%d, %d)\nRect: (%d, %d, %d, %d)", cx, cy, cx * 8, cy * 8, cx * 8 + 7, cy * 8 + 7);
|
||||||
// TODO here we should hilite the offending block
|
// TODO here we should hilite the offending block
|
||||||
printf("\nerror at %dx%d (%d colors)\n",cx*8,cy*8,numcolors);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
c1 = 0; c2 = 0;
|
c1 = 0; c2 = 0;
|
||||||
@ -3006,7 +3005,7 @@ int Save_C64_multi(T_IO_Context *context, char *filename, byte saveWhat, byte lo
|
|||||||
numcolors=Count_used_colors_area(cusage,cx*4,cy*8,4,8);
|
numcolors=Count_used_colors_area(cusage,cx*4,cy*8,4,8);
|
||||||
if(numcolors>4)
|
if(numcolors>4)
|
||||||
{
|
{
|
||||||
Warning_message("More than 4 colors in 4x8");
|
Warning_with_format("More than 4 colors\nin 4x8 pixel cell: (%d, %d)\nRect: (%d, %d, %d, %d)", cx, cy, cx * 4, cy * 8, cx * 4 + 3, cy * 8 + 7);
|
||||||
// TODO hilite offending block
|
// TODO hilite offending block
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdarg.h> // va_args ...
|
||||||
#include <stdlib.h> // atoi()
|
#include <stdlib.h> // atoi()
|
||||||
#include <string.h> // strncpy() strlen()
|
#include <string.h> // strncpy() strlen()
|
||||||
|
|
||||||
@ -1183,6 +1184,26 @@ void Warning_message(char * message)
|
|||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Window that shows a warning message and waits for a click on the OK button
|
||||||
|
/// This has the added advantage of supporting the printf interface.
|
||||||
|
void Warning_with_format(const char *template, ...) {
|
||||||
|
va_list arg_ptr;
|
||||||
|
char *message;
|
||||||
|
|
||||||
|
message = malloc(sizeof(char) * 1024); // a maximum of 1 KiB of complete message.
|
||||||
|
if (message) {
|
||||||
|
va_start(arg_ptr, template);
|
||||||
|
vsprintf(message, template, arg_ptr);
|
||||||
|
//Warning_message(message);
|
||||||
|
Verbose_message("Warning", message);
|
||||||
|
va_end(arg_ptr);
|
||||||
|
free(message);
|
||||||
|
} else {
|
||||||
|
//Warning_message(template);
|
||||||
|
Verbose_message("Warning", template);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Window that shows a big message (up to 35x13), and waits for a click on OK.
|
/// Window that shows a big message (up to 35x13), and waits for a click on OK.
|
||||||
/// On call: Cursor must be displayed
|
/// On call: Cursor must be displayed
|
||||||
/// On exit: Cursor is displayed
|
/// On exit: Cursor is displayed
|
||||||
|
|||||||
@ -76,6 +76,7 @@ void Print_counter(short x,short y,const char * str,byte text_color,byte backgro
|
|||||||
|
|
||||||
byte Confirmation_box(char * message);
|
byte Confirmation_box(char * message);
|
||||||
void Warning_message(char * message);
|
void Warning_message(char * message);
|
||||||
|
void Warning_with_format(const char * message, ...);
|
||||||
void Verbose_message(const char * caption, const char * message);
|
void Verbose_message(const char * caption, const char * message);
|
||||||
int Requester_window(char* message, int initial_value);
|
int Requester_window(char* message, int initial_value);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user