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

Function dovspell

src/spell.c:2020–2053  ·  view source on GitHub ↗

the #showspells command -- view known spells */

Source from the content-addressed store, hash-verified

2018
2019/* the #showspells command -- view known spells */
2020int
2021dovspell(void)
2022{
2023 char qbuf[QBUFSZ];
2024 int splnum, othnum;
2025 struct spell spl_tmp;
2026
2027 if (spellid(0) == NO_SPELL) {
2028 You("don't know any spells right now.");
2029 } else {
2030 while (dospellmenu("Currently known spells",
2031 SPELLMENU_VIEW, &splnum)) {
2032 if (splnum == SPELLMENU_SORT) {
2033 if (spellsortmenu())
2034 sortspells();
2035 } else {
2036 Sprintf(qbuf, "Reordering spells; swap '%c' with",
2037 spellet(splnum));
2038 if (!dospellmenu(qbuf, splnum, &othnum))
2039 break;
2040
2041 spl_tmp = svs.spl_book[splnum];
2042 svs.spl_book[splnum] = svs.spl_book[othnum];
2043 svs.spl_book[othnum] = spl_tmp;
2044 }
2045 }
2046 }
2047 if (gs.spl_orderindx) {
2048 free((genericptr_t) gs.spl_orderindx);
2049 gs.spl_orderindx = 0;
2050 }
2051 gs.spl_sortmode = SORTBY_LETTER; /* 0 */
2052 return ECMD_OK;
2053}
2054
2055DISABLE_WARNING_FORMAT_NONLITERAL
2056

Callers

nothing calls this directly

Calls 4

YouFunction · 0.85
dospellmenuFunction · 0.85
spellsortmenuFunction · 0.85
sortspellsFunction · 0.85

Tested by

no test coverage detected