Data Structures | Functions | Variables
ui-spell.c File Reference

Spell UI handing. More...

#include "angband.h"
#include "cave.h"
#include "cmds.h"
#include "cmd-core.h"
#include "game-input.h"
#include "obj-tval.h"
#include "obj-util.h"
#include "object.h"
#include "player-spell.h"
#include "ui-menu.h"
#include "ui-output.h"

Data Structures

struct  spell_menu_data
 Spell menu data struct. More...


static int spell_menu_valid (struct menu *m, int oid)
 Is item oid valid?
static void spell_menu_display (struct menu *m, int oid, bool cursor, int row, int col, int wid)
 Display a row of the spell menu.
static bool spell_menu_handler (struct menu *m, const ui_event *e, int oid)
 Handle an event on a menu row.
static void spell_menu_browser (int oid, void *data, const region *loc)
 Show spell long description when browsing.
static struct menuspell_menu_new (const object_type *o_ptr, bool(*is_valid)(int spell))
 Create and initialise a spell menu, given an object and a validity hook.
static void spell_menu_destroy (struct menu *m)
 Clean up a spell menu instance.
static int spell_menu_select (struct menu *m, const char *noun, const char *verb)
 Run the spell menu to select a spell.
static void spell_menu_browse (struct menu *m, const char *noun)
 Run the spell menu, without selections.
void textui_book_browse (const object_type *o_ptr)
 Browse a given book.
void textui_spell_browse (void)
 Browse the given book.
int textui_get_spell_from_book (const char *verb, struct object *book, const char *error, bool(*spell_filter)(int spell))
 Get a spell from specified book.
int textui_get_spell (const char *verb, item_tester book_filter, cmd_code cmd, const char *error, bool(*spell_filter)(int spell))
 Get a spell from the player.


static const menu_iter spell_menu_iter

Detailed Description

Spell UI handing.

Copyright (c) 2010 Andi Sidwell

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Function Documentation

static void spell_menu_browse ( struct menu m,
const char *  noun 
static void spell_menu_browser ( int  oid,
void data,
const region loc 
static void spell_menu_destroy ( struct menu m)

Clean up a spell menu instance.

References mem_free(), and menu_priv().

Referenced by textui_book_browse(), and textui_get_spell_from_book().

static void spell_menu_display ( struct menu m,
int  oid,
bool  cursor,
int  row,
int  col,
int  wid 
static bool spell_menu_handler ( struct menu m,
const ui_event e,
int  oid 
static struct menu* spell_menu_new ( const object_type o_ptr,
bool(*)(int spell)  is_valid 
static int spell_menu_select ( struct menu m,
const char *  noun,
const char *  verb 
static int spell_menu_valid ( struct menu m,
int  oid 

Is item oid valid?

References spell_menu_data::is_valid, menu_priv(), and spell_menu_data::spells.

void textui_book_browse ( const object_type o_ptr)
int textui_get_spell ( const char *  verb,
item_tester  book_filter,
cmd_code  cmd,
const char *  error,
bool(*)(int spell)  spell_filter 

Get a spell from the player.

References get_item(), my_strcap(), menu::prompt, strnfmt(), textui_get_spell_from_book(), USE_FLOOR, and USE_INVEN.

Referenced by textui_input_init().

int textui_get_spell_from_book ( const char *  verb,
struct object book,
const char *  error,
bool(*)(int spell)  spell_filter 
void textui_spell_browse ( void  )

Variable Documentation

const menu_iter spell_menu_iter
Initial value: