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

Function wizcustom_callback

src/wizcmds.c:1986–2027  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1984}
1985
1986void
1987wizcustom_callback(winid win, int glyphnum, char *id)
1988{
1989 extern glyph_map glyphmap[MAX_GLYPH];
1990 glyph_map *cgm;
1991 int clr = NO_COLOR;
1992 char buf[BUFSZ], bufa[BUFSZ], bufb[BUFSZ], bufc[BUFSZ], bufd[BUFSZ],
1993 bufu[BUFSZ];
1994 anything any;
1995 uint8 *cp;
1996
1997 if (win && id) {
1998 cgm = &glyphmap[glyphnum];
1999 if (
2000#ifdef ENHANCED_SYMBOLS
2001 cgm->u ||
2002#endif
2003 cgm->customcolor != 0) {
2004 Sprintf(bufa, "[%04d] %-44s", glyphnum, id);
2005 Sprintf(bufb, "'\\%03d' %02d",
2006 gs.showsyms[cgm->sym.symidx], cgm->sym.color);
2007 Sprintf(bufc, "%011lx", (unsigned long) cgm->customcolor);
2008 bufu[0] = '\0';
2009#ifdef ENHANCED_SYMBOLS
2010 if (cgm->u && cgm->u->utf8str) {
2011 Sprintf(bufu, "U+%04lx", (unsigned long) cgm->u->utf32ch);
2012 cp = cgm->u->utf8str;
2013 while (*cp) {
2014 Sprintf(bufd, " <%d>", (int) *cp);
2015 Strcat(bufu, bufd);
2016 cp++;
2017 }
2018 }
2019#endif
2020 any.a_int = glyphnum + 1; /* avoid 0 */
2021 Snprintf(buf, sizeof buf, "%s %s %s %s", bufa, bufb, bufc, bufu);
2022 add_menu(win, &nul_glyphinfo, &any, 0, 0, ATR_NONE, clr, buf,
2023 MENU_ITEMFLAGS_NONE);
2024 }
2025 }
2026 return;
2027}
2028
2029/*wizcmds.c*/

Callers 1

wizcustom_glyphidsFunction · 0.85

Calls 1

add_menuFunction · 0.85

Tested by

no test coverage detected