Angband
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-calcs.h"
#include "player-spell.h"
#include "ui-menu.h"
#include "ui-output.h"

Data Structures

struct  spell_menu_data
 Spell menu data struct. More...
 

Functions

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

Variables

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
static void spell_menu_browser ( int  oid,
void data,
const region loc 
)
static
static void spell_menu_destroy ( struct menu m)
static

Clean up a spell menu instance.

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

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
static bool spell_menu_handler ( struct menu m,
const ui_event e,
int  oid 
)
static
static struct menu* spell_menu_new ( const struct object obj,
bool(*)(int spell_index)  is_valid 
)
static
static int spell_menu_select ( struct menu m,
const char *  noun,
const char *  verb 
)
static
static int spell_menu_valid ( struct menu m,
int  oid 
)
static

Is item oid valid?

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

void textui_book_browse ( const struct object obj)
int textui_get_spell ( const char *  verb,
item_tester  book_filter,
cmd_code  cmd,
const char *  error,
bool(*)(int spell_index)  spell_filter 
)

Get a spell from the player.

References get_item(), my_strcap(), 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_index)  spell_filter 
)
void textui_spell_browse ( void  )

Variable Documentation

const menu_iter spell_menu_iter
static
Initial value:
= {
NULL,
}
static int spell_menu_valid(struct menu *m, int oid)
Is item oid valid?
Definition: ui-spell.c:50
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.
Definition: ui-spell.c:61
static bool spell_menu_handler(struct menu *m, const ui_event *e, int oid)
Handle an event on a menu row.
Definition: ui-spell.c:108
NULL
Definition: list-summon-types.h:18