fix tilemap - no panic()

tilemap isn't linked with util/panic.o so doesn't have access to
panic().  Despite that, linking on OSX found panic() somewhere.
(It doesn't do format argument substitution, just prints out the
argument we pass as format string, then aborts.)

Instead of calling panic(), print a message to stderr, delete the
incomplete tile.c whose construction has failed, and exit with
failure status.  Linking with panic.o wouldn't handle the message
and final failure but not help with the incomplete output file part,
so this hasn't done that.
This commit is contained in:
PatR
2022-12-31 13:35:17 -08:00
parent 765c853a5a
commit e1a2432233

View File

@@ -1371,7 +1371,10 @@ main(int argc UNUSED, char *argv[] UNUSED)
for (i = 0; i < MAX_GLYPH; i++) {
tilenum = tilemap[i].tilenum;
if (tilenum < 0) { /* will be -1 if not assigned a real value */
panic("tilemap: glyph %d maps to tile %d.", i, tilenum);
Fprintf(stderr, "ERROR: glyph %d maps to tile %d.\n", i, tilenum);
(void) fclose(ofp);
unlink(filename);
exit(EXIT_FAILURE);
/*NOTREACHED*/
}
Fprintf(ofp,