fix error checking during tile processing

noticed following a patch last night
This commit is contained in:
nhmall
2021-10-28 16:08:59 -04:00
parent 49b2ea1b89
commit b6250b412d
4 changed files with 35 additions and 26 deletions

View File

@@ -110,7 +110,7 @@ read_txttile(FILE *txtfile, pixel (*pixels)[TILE_X])
int ph, i, j, k, reslt;
char buf[BUFSZ], ttype[BUFSZ], gend[BUFSZ];
const char *p;
char c[2];
char c[2], *q;
static int gidx = 0;
gend[0] = '\0';
@@ -133,11 +133,18 @@ read_txttile(FILE *txtfile, pixel (*pixels)[TILE_X])
* change when tiles are added
*/
p = tilename(tile_set, tile_set_indx, gidx);
if (p && strcmp(p, buf)
&& !acceptable_tilename(tile_set, tile_set_indx, buf, p)) {
Fprintf(stderr, "warning: for tile %d (numbered %d) of %s,\n",
tile_set_indx, i, text_sets[tile_set]);
Fprintf(stderr, "\tfound '%s' while expecting '%s'\n", buf, p);
if (p && (q = strstr(p, " {")) != 0) {
*q = '\0';
}
if (p && strcmp(p, buf)) {
boolean other_mismatch =
(tile_set == OTHER_SET
&& !acceptable_tilename(tile_set, tile_set_indx, buf, p));
if (tile_set != OTHER_SET || other_mismatch) {
Fprintf(stderr, "warning: for tile %d (numbered %d) of %s,\n",
tile_set_indx, i, text_sets[tile_set]);
Fprintf(stderr, "\tfound '%s' while expecting '%s'\n", buf, p);
}
}
tile_set_indx++;