the #showspells command -- view known spells */
| 2018 | |
| 2019 | /* the #showspells command -- view known spells */ |
| 2020 | int |
| 2021 | dovspell(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 | |
| 2055 | DISABLE_WARNING_FORMAT_NONLITERAL |
| 2056 |
nothing calls this directly
no test coverage detected