MCPcopy Create free account
hub / github.com/NetHack/NetHack / examine_tilefiles

Function examine_tilefiles

win/share/tile2bmp.c:364–395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362}
363
364static int
365examine_tilefiles(void)
366{
367 FILE *fp2;
368 int i, tiles_in_file;
369 char tilefile_full_path[256];
370
371 for (i = 0; i < SIZE(tilefilenames[0]); ++i) {
372 tiles_in_file = 0;
373 if (!set_tilefile_path(relative_tiledir,
374 tilefilenames[tilefileset][i],
375 tilefile_full_path,
376 sizeof tilefile_full_path)) {
377 Fprintf(stderr, "tile2bmp path issue %s/%s %d\n",
378 relative_tiledir, tilefilenames[tilefileset][i],
379 (int) sizeof tilefile_full_path);
380 return 0;
381 }
382 fp2 = fopen(tilefile_full_path, "r");
383 if (fp2) {
384 char line[256];
385
386 while (fgets(line, sizeof line, fp2)) {
387 if (!strncmp(line, "# tile ", 7))
388 tiles_in_file++;
389 }
390 (void) fclose(fp2);
391 tilecnt[i] = tiles_in_file;
392 }
393 }
394 return 1;
395}
396
397/*tile2bmp.c*/

Callers 1

mainFunction · 0.85

Calls 3

set_tilefile_pathFunction · 0.85
fgetsFunction · 0.85
fcloseFunction · 0.85

Tested by

no test coverage detected