MCPcopy Index your code
hub / github.com/NetHack/NetHack / main

Function main

win/share/tilemap.c:1311–1401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1309#endif
1310
1311DISABLE_WARNING_UNREACHABLE_CODE
1312
1313int
1314main(int argc, char *argv[])
1315{
1316 int i, tilenum;
1317 char filename[30];
1318 FILE *ofp;
1319 const char *enhanced;
1320 const char indent[] = " ";
1321
1322#if defined(OBTAIN_TILEMAP)
1323 objects_globals_init();
1324 monst_globals_init();
1325#endif
1326
1327 init_tilemap();
1328
1329#ifdef ENHANCED_SYMBOLS
1330 enhanced = ", utf8rep";
1331#else
1332 enhanced = "";
1333#endif
1334 /*
1335 * create the source file, "tile.c"
1336 */
1337 Snprintf(filename, sizeof filename, SOURCE_TEMPLATE, TILE_FILE);
1338 if (!(ofp = fopen(filename, "w"))) {
1339 perror(filename);
1340 exit(EXIT_FAILURE);
1341 }
1342 Fprintf(ofp,
1343 "/* This file is automatically generated. Do not edit. */\n");
1344 Fprintf(ofp, "\n#include \"hack.h\"\n");
1345 Fprintf(ofp, "\n#ifndef TILES_IN_GLYPHMAP\n");
1346 Fprintf(ofp, "\n#else /* ?TILES_IN_GLYPHMAP */\n");
1347 Fprintf(ofp, "\nenum special_tiles {\n");
1348 Fprintf(ofp, " TILE_CORR = %d,\n", TILE_corr);
1349 Fprintf(ofp, " TILE_STONE = %d,\n", TILE_stone);
1350 Fprintf(ofp, " TILE_UNEXPLORED = %d\n", TILE_unexplored);
1351 Fprintf(ofp, "};\n");
1352 Fprintf(ofp, "\nint total_tiles_used = %d,\n", laststatuetile + 1);
1353 Fprintf(ofp, "%sTile_corr = TILE_CORR,\n", indent); /* X11 uses it */
1354 Fprintf(ofp, "%sTile_stone = TILE_STONE,\n", indent);
1355 Fprintf(ofp, "%sTile_unexplored = TILE_UNEXPLORED,\n", indent);
1356 Fprintf(ofp, "%smaxmontile = %d,\n", indent, lastmontile);
1357 Fprintf(ofp, "%smaxobjtile = %d,\n", indent, lastobjtile);
1358 Fprintf(ofp, "%smaxothtile = %d;\n\n", indent, lastothtile);
1359 Fprintf(ofp, "#define NO_CUSTOMCOLOR (0U)\n\n");
1360 Fprintf(ofp, "/* glyph, ttychar, { %s%s } */\n",
1361 "glyphflags, { NO_COLOR, symidx }, NO_CUSTOMCOLOR, NO_CUSTOMCOLOR, ovidx, tileidx", enhanced);
1362#ifdef ENHANCED_SYMBOLS
1363 enhanced = ", 0"; /* replace ", utf8rep" since we're done with that */
1364#endif
1365 Fprintf(ofp, "const glyph_info nul_glyphinfo = {\n");
1366 Fprintf(ofp, "%sNO_GLYPH, ' ', NO_COLOR,\n", indent);
1367 Fprintf(ofp, "%s%s/* glyph_map */\n", indent, indent);
1368 Fprintf(ofp, "%s%s{ %s, TILE_UNEXPLORED%s }\n", indent, indent,

Callers

nothing calls this directly

Calls 6

objects_globals_initFunction · 0.85
monst_globals_initFunction · 0.85
init_tilemapFunction · 0.85
fcloseFunction · 0.85
unlinkFunction · 0.85
free_tilerefsFunction · 0.85

Tested by

no test coverage detected