x11 utility tile name comparisons were checking against unitialized data

This commit is contained in:
nhmall
2020-07-25 11:41:58 -04:00
parent 84ccc14451
commit c37882d16b
+7
View File
@@ -22,6 +22,9 @@ unsigned char tile_bytes[TILE_X * TILE_Y * (MAX_GLYPH + TILES_PER_ROW)];
unsigned char *curr_tb = tile_bytes; unsigned char *curr_tb = tile_bytes;
unsigned char x11_colormap[MAXCOLORMAPSIZE][3]; unsigned char x11_colormap[MAXCOLORMAPSIZE][3];
extern void NDECL(monst_globals_init);
extern void NDECL(objects_globals_init);
/* Look up the given pixel and return its colormap index. */ /* Look up the given pixel and return its colormap index. */
static unsigned char static unsigned char
pix_to_colormap(pix) pix_to_colormap(pix)
@@ -187,6 +190,10 @@ char **argv;
exit(1); exit(1);
} }
/* without this, the comparisons check uninitialized data and won't pass */
objects_globals_init();
monst_globals_init();
fp = fopen(OUTNAME, "w"); fp = fopen(OUTNAME, "w");
if (!fp) { if (!fp) {
Fprintf(stderr, "can't open output file\n"); Fprintf(stderr, "can't open output file\n");