/** * Interactively select a spell. * * Returns the spell selected, or -1. */ static int get_spell(const object_type * o_ptr, const char *verb, bool(*spell_test) (int spell)) { menu_type *m; const char *noun; noun = magic_desc[mp_ptr->spell_realm][SPELL_NOUN]; m = spell_menu_new(o_ptr, spell_test); if (m) { int spell = spell_menu_select(m, noun, verb); spell_menu_destroy(m); return spell; } return -1; }
/** * Get a spell from specified book. */ int textui_get_spell_from_book(const char *verb, struct object *book, const char *error, bool (*spell_filter)(int spell_index)) { const char *noun = player->class->magic.spell_realm->spell_noun; struct menu *m; track_object(player->upkeep, book); handle_stuff(player); m = spell_menu_new(book, spell_filter); if (m) { int spell_index = spell_menu_select(m, noun, verb); spell_menu_destroy(m); return spell_index; } return -1; }