NO_TILE_C => no USE_TILES in tile.c

Compiling with NO_TILE_C defined results in preventing USE_TILES
from being defined and that causes display.c to use alternate code.
Construct src/tile.c such that nethack links successfully if the
configuration specifies NO_TILE_C but the Makefile goes ahead and
builds tile.c, compiles it, and links with it, otherwise it conflicts
with that alternate code.  Prior to this, linking gave two complaints
about duplicate symbols and failed.
This commit is contained in:
PatR
2021-12-31 13:49:43 -08:00
parent eddbff351e
commit d19e80ae2f

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 tilemap.c $NHDT-Date: 1639622363 2021/12/16 02:39:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.63 $ */
/* NetHack 3.7 tilemap.c $NHDT-Date: 1640987372 2021/12/31 21:49:32 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.64 $ */
/* Copyright (c) 2016 by Michael Allison */
/* NetHack may be freely redistributed. See license for details. */
@@ -95,11 +95,15 @@ const char *expl_texts[] = {
"dark", "noxious", "muddy", "wet", "magical", "fiery", "frosty",
};
const char *zap_texts[] = { "missile", "fire", "frost", "sleep",
"death", "lightning", "poison gas", "acid" };
const char *zap_texts[] = {
"missile", "fire", "frost", "sleep",
"death", "lightning", "poison gas", "acid",
};
enum tilesrc {monsters_file, objects_file, other_file, generated};
const char *tilesrc_texts[] = { "monsters.txt", "objects.txt", "other.txt", "generated" };
enum tilesrc { monsters_file, objects_file, other_file, generated };
const char *tilesrc_texts[] = {
"monsters.txt", "objects.txt", "other.txt", "generated",
};
struct tilemap_t {
short tilenum;
@@ -1265,7 +1269,7 @@ init_tilemap(void)
}
/* go beyond NUMMONS to cover off the invisible tile at the
end of monsters.txt so that the tile mapping matches things
the .bmp file (for example) */
in the .bmp file (for example) */
file_entry = 0;
#if defined(OBTAIN_TILEMAP)
add_tileref(tilenum, NO_GLYPH, monsters_file, file_entry,
@@ -1276,8 +1280,8 @@ init_tilemap(void)
#if defined(OBTAIN_TILEMAP)
for (i = 0; i < MAX_GLYPH; ++i) {
Fprintf(tilemap_file, "glyph[%04d] [%04d] %-80s\n", i, tilemap[i].tilenum,
tilemap[i].name);
Fprintf(tilemap_file, "glyph[%04d] [%04d] %-80s\n",
i, tilemap[i].tilenum, tilemap[i].name);
}
dump_tilerefs(tilemap_file);
fclose(tilemap_file);
@@ -1317,17 +1321,20 @@ main(int argc UNUSED, char *argv[] UNUSED)
Fprintf(ofp,
"/* This file is automatically generated. Do not edit. */\n");
Fprintf(ofp, "\n#include \"hack.h\"\n");
Fprintf(ofp, "\n#ifdef USE_TILES\n");
Fprintf(ofp, "\nint total_tiles_used = %d,\n", laststatuetile + 1);
Fprintf(ofp, "%sTile_corr = %d,\n", indent, TILE_corr); /* X11 references it */
Fprintf(ofp, "%sTile_stone = %d,\n", indent, TILE_stone);
Fprintf(ofp, "%sTile_unexplored = %d;\n\n", indent, TILE_unexplored);
Fprintf(ofp, "/* glyph, ttychar, { color, symidx, ovidx, glyphflags, tileidx} */\n");
Fprintf(ofp,
"/* glyph, ttychar, { color, symidx, ovidx, glyphflags, tileidx} */\n");
Fprintf(ofp, "const glyph_info nul_glyphinfo = { \n");
Fprintf(ofp, "%sNO_GLYPH, ' ',\n", indent);
Fprintf(ofp, "%s%s{ /* glyph_map */\n", indent, indent);
Fprintf(ofp, "%s%s%sNO_COLOR, SYM_UNEXPLORED + SYM_OFF_X,\n",
indent, indent, indent);
Fprintf(ofp, "%s%s%sMG_UNEXPL, %d\n", indent, indent, indent, TILE_unexplored);
indent, indent, indent);
Fprintf(ofp, "%s%s%sMG_UNEXPL, %d\n", indent, indent, indent,
TILE_unexplored);
Fprintf(ofp, "%s%s}\n", indent, indent);
Fprintf(ofp, "};\n");
Fprintf(ofp, "\nglyph_map glyphmap[MAX_GLYPH] = {\n");
@@ -1341,6 +1348,7 @@ main(int argc UNUSED, char *argv[] UNUSED)
tilemap[i].name);
}
Fprintf(ofp, "};\n");
Fprintf(ofp, "\n#endif /* USE_TILES */\n");
Fprintf(ofp, "\n/*tile.c*/\n");
(void) fclose(ofp);