Atrinik Client 2.5
Enumerations | Functions | Variables
gui/spells.c File Reference
#include <global.h>

Go to the source code of this file.

Enumerations

enum  { SPELLS_FILTER_SPELL, SPELLS_FILTER_PRAYER, SPELLS_FILTER_ALL }

Functions

static void list_handle_enter (list_struct *list)
static const char * list_text_color_hook (list_struct *list, const char *default_color, uint32 row, uint32 col)
static void spell_list_reload ()
static void button_repeat_func (button_struct *button)
static void button_filter_adjust (int adj)
void widget_spells_render (widgetdata *widget)
void widget_spells_mevent (widgetdata *widget, SDL_Event *event)
int spell_find (const char *name, size_t *spell_path, size_t *spell_id)
int spell_find_path_selected (const char *name, size_t *spell_id)
spell_entry_structspell_get (size_t spell_path, size_t spell_id)
void spells_init ()
void spells_reload ()
void SpelllistCmd (char *data)

Variables

static spell_entry_struct ** spell_list [SPELL_PATH_NUM]
static size_t spell_list_num [SPELL_PATH_NUM]
static size_t spell_list_path = 0
static uint8 spell_list_filter_known
static uint8 spell_list_filter_type
static const char *const filter_names [SPELLS_FILTER_ALL+1]
static button_struct button_path_left
static button_struct button_path_right
static button_struct button_close
static button_struct button_filter_left
static button_struct button_filter_right
static button_struct button_filter_known
static button_struct button_help

Detailed Description

Handles the spells widget code.

Definition in file spells.c.


Enumeration Type Documentation

anonymous enum

Available filter types.

Enumerator:
SPELLS_FILTER_SPELL 

Only spells.

SPELLS_FILTER_PRAYER 

Only prayers.

SPELLS_FILTER_ALL 

Both spells and prayers.

Definition at line 35 of file spells.c.


Function Documentation

static void button_filter_adjust ( int  adj) [static]

Click filter button.

Parameters:
adj1 if the right button was clicked, -1 if the left one was clicked instead.

Definition at line 196 of file spells.c.

static void button_repeat_func ( button_struct button) [static]

Handle button repeating (and actual pressing).

Parameters:
buttonThe button.

Definition at line 166 of file spells.c.

static void list_handle_enter ( list_struct list) [static]

Handle double click inside the spells list.

Parameters:
listThe spells list.

Definition at line 75 of file spells.c.

static const char* list_text_color_hook ( list_struct list,
const char *  default_color,
uint32  row,
uint32  col 
) [static]

Handle list::text_color_hook in the spells list.

Definition at line 89 of file spells.c.

int spell_find ( const char *  name,
size_t *  spell_path,
size_t *  spell_id 
)

Find a spell in the spell_list based on its name.

Partial spell names will be matched.

Parameters:
nameSpell name to find.
[out]spell_pathWill contain the spell's path.
[out]spell_idWill contain the spell's ID.
Returns:
1 if the spell was found, 0 otherwise.

Definition at line 436 of file spells.c.

int spell_find_path_selected ( const char *  name,
size_t *  spell_id 
)

Find a spell in the spell_list based on its name, but only look inside the currently selected spell path list.

Partial spell names will be matched.

Parameters:
nameSpell name to find.
[out]spell_idWill contain the spell's ID.
Returns:
1 if the spell was found, 0 otherwise.

Definition at line 460 of file spells.c.

spell_entry_struct* spell_get ( size_t  spell_path,
size_t  spell_id 
)

Get spell from the spell_list structure.

Parameters:
spell_pathSpell path.
spell_idSpell ID.
Returns:
The spell.

Definition at line 478 of file spells.c.

static void spell_list_reload ( ) [static]

Reload the spells list, due to a change of the spell path, filtering options, etc.

Definition at line 111 of file spells.c.

void SpelllistCmd ( char *  data)

Spell list command. Used to update the player's spell list.

Parameters:
dataThe incoming data.

Definition at line 622 of file spells.c.

void spells_init ( )

Initialize the spell list from file.

Definition at line 485 of file spells.c.

void spells_reload ( )

Reload the icon IDs, as they may have changed due to an update.

Definition at line 606 of file spells.c.

void widget_spells_mevent ( widgetdata widget,
SDL_Event *  event 
)

Handle mouse events inside the spells widget.

Parameters:
widgetThe spells widget.
eventThe event to handle.

Definition at line 367 of file spells.c.

void widget_spells_render ( widgetdata widget)

Render the spell list widget.

Parameters:
widgetThe widget to render.

Definition at line 216 of file spells.c.


Variable Documentation

Button buffer.

Definition at line 70 of file spells.c.

const char* const filter_names[SPELLS_FILTER_ALL+1] [static]
Initial value:
{
    "Spells", "Prayers", "All"
}

Names for filter types.

Definition at line 64 of file spells.c.

spell_entry_struct** spell_list[SPELL_PATH_NUM] [static]

The spell list. This is a multi-dimensional array, containing dynamically resized spell path arrays, which actually hold the spells for each spell path. For example (pseudo array structure):

  • spell_list:
    • fire
      • firestorm, firebolt

Definition at line 53 of file spells.c.

If 1, only show known spells in the list of spells.

Definition at line 59 of file spells.c.

One of filter types.

Definition at line 61 of file spells.c.

size_t spell_list_num[SPELL_PATH_NUM] [static]

Number of spells contained in each spell path array in spell_list.

Definition at line 55 of file spells.c.

size_t spell_list_path = 0 [static]

Currently selected spell path ID.

Definition at line 57 of file spells.c.