glyph_to_cmap() becomes function instead of macro

Also adds swallow and explosion glyphs to glyph_to_cmap()

References:
https://github.com/NetHack/NetHack/pull/1022 by argrath
https://github.com/NetHack/NetHack/pull/1277 by ars3niy

Closes #1277
Closes #1022
This commit is contained in:
nhmall
2024-09-14 10:11:28 -04:00
parent 04433aead8
commit cbb32ac64a
4 changed files with 5 additions and 5 deletions

View File

@@ -2873,6 +2873,7 @@ remove a null sobj check from gold_detect that was situated after
check for valid indexes of def_monsyms[] and def_oc_syms[] in
choose_classes_menu() (pr #1179 by argrath)
split damage from acid potion into separate function (pr #1195 by argrath)
add swallow and explosion glyphs to glyph_to_cmap() (pr #1277 by ars3niy)
Code Cleanup and Reorganization
@@ -3005,4 +3006,5 @@ remove TEXTCOLOR build option
relocate general-purpose function choose_classes_menu(), from
options.c to windows.c
remove register from variable declarations
make glyph_to_cmap() a function instead of a macro

View File

@@ -723,10 +723,6 @@ enum glyph_offsets {
#define glyph_is_cmap(glyph) \
((glyph) >= GLYPH_CMAP_STONE_OFF \
&& (glyph) < (GLYPH_CMAP_C_OFF + ((S_goodpos - S_digbeam) + 1)))
/* final MAXPCHARS is legal array index because of trailing fencepost entry */
int glyph_to_cmap(int glpyh);
#define glyph_to_swallow(glyph) \
(glyph_is_swallow(glyph) ? (((glyph) - GLYPH_SWALLOW_OFF) & 0x7) : 0)
#define glyph_to_explosion(glyph) \

View File

@@ -1124,6 +1124,7 @@ extern void purge_all_custom_entries(void);
extern void dump_glyphids(void);
extern void clear_all_glyphmap_colors(void);
extern void reset_customcolors(void);
extern int glyph_to_cmap(int);
/* ### hack.c ### */

View File

@@ -221,7 +221,8 @@ glyph_to_cmap(int glyph)
else if (glyph_is_explosion(glyph))
return glyph_to_explosion(glyph) + S_expl_tl;
else
return MAXPCHARS;
return MAXPCHARS; /* MAXPCHARS is legal array index because
of trailing fencepost entry */
}
staticfn int