Crossfire Client, Branches  R11627
item.c File Reference
#include <ctype.h>
#include <client.h>
#include <item.h>
#include <newclient.h>
#include <external.h>
#include <script.h>
#include <item-types.h>
+ Include dependency graph for item.c:

Go to the source code of this file.

Macros

#define NROF_ITEMS   50 /* how many items are reserved initially */
 

Functions

static void add_item (item *env, item *op)
 
static itemalloc_items (int nrof)
 
void animate_objects (void)
 
int can_write_spell_on (item *it)
 
itemcreate_new_item (item *env, sint32 tag)
 
void free_all_items (item *op)
 
static void get_flags (item *op, uint16 flags)
 
const char * get_number (uint32 i)
 
uint8 get_type_from_name (const char *name)
 
void inscribe_magical_scroll (item *scroll, Spell *spell)
 
static void insert_item_before_item (item *newitem, item *before)
 
itemlocate_item (sint32 tag)
 
static itemlocate_item_from_item (item *op, sint32 tag)
 
itemmap_item (void)
 
static itemnew_item (void)
 
int num_free_items (void)
 
itemplayer_item (void)
 
void print_inventory (item *op)
 
void remove_item (item *op)
 
void remove_item_inventory (item *op)
 
void send_mark_obj (item *op)
 
static void set_flag_string (item *op)
 
void set_item_values (item *op, char *name, sint32 weight, uint16 face, uint16 flags, uint16 anim, uint16 animspeed, uint32 nrof, uint16 type)
 
void toggle_locked (item *op)
 
void update_item (int tag, int loc, char *name, int weight, int face, int flags, int anim, int animspeed, uint32 nrof, int type)
 
void update_item_sort (item *it)
 

Variables

static const char *const apply_string []
 
static itemfree_items
 
static itemmap
 
static itemplayer
 
const char *const rcsid_common_item_c
 

Macro Definition Documentation

#define NROF_ITEMS   50 /* how many items are reserved initially */

Definition at line 37 of file item.c.

Referenced by create_new_item().

Function Documentation

static void add_item ( item env,
item op 
)
static

Definition at line 398 of file item.c.

References item_struct::env, item_struct::inv, item_struct::next, and item_struct::prev.

Referenced by create_new_item().

+ Here is the caller graph for this function:

static item* alloc_items ( int  nrof)
static

Definition at line 241 of file item.c.

References list, new_item(), item_struct::next, and item_struct::prev.

Referenced by create_new_item().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int can_write_spell_on ( item it)

Definition at line 752 of file item.c.

References item_struct::type.

Referenced by item_event_item_changed(), item_event_item_deleting(), and spellinventory_redraw().

+ Here is the caller graph for this function:

item* create_new_item ( item env,
sint32  tag 
)

Definition at line 422 of file item.c.

References add_item(), alloc_items(), free_items, item_struct::locked, item_struct::next, NROF_ITEMS, item_struct::prev, and item_struct::tag.

Referenced by update_item().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void free_all_items ( item op)

Definition at line 258 of file item.c.

References free_all_items(), item_struct::inv, and item_struct::next.

Referenced by free_all_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void get_flags ( item op,
uint16  flags 
)
static
const char* get_number ( uint32  i)

Definition at line 182 of file item.c.

References MAX_BUF.

Referenced by set_item_values().

+ Here is the caller graph for this function:

uint8 get_type_from_name ( const char *  name)

Definition at line 49 of file item.c.

References item_types, LOG(), LOG_WARNING, and NUM_ITEM_TYPES.

Referenced by set_item_values().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void inscribe_magical_scroll ( item scroll,
Spell spell 
)

Definition at line 756 of file item.c.

References command_inscribe, csocket, ClientSocket::fd, LOG(), LOG_WARNING, MAX_BUF, script_monitor_str(), SockList_AddChar(), SockList_AddInt(), SockList_AddString(), SockList_Init(), SockList_Send(), item_struct::tag, and Spell_struct::tag.

Referenced by click_inscribe_spell().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void insert_item_before_item ( item newitem,
item before 
)
static

Definition at line 78 of file item.c.

References item_struct::env, item_struct::inv, item_struct::inv_updated, item_struct::next, and item_struct::prev.

Referenced by update_item_sort().

+ Here is the caller graph for this function:

item* locate_item ( sint32  tag)

Definition at line 292 of file item.c.

References Player_Struct::container, cpl, item_struct::inv, locate_item_from_item(), map, and item_struct::tag.

Referenced by common_item_command(), DeleteInventory(), DeleteItem(), main(), update_item(), and UpdateItemCmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static item* locate_item_from_item ( item op,
sint32  tag 
)
static

Definition at line 274 of file item.c.

References item_struct::inv, item_struct::next, and item_struct::tag.

Referenced by locate_item().

+ Here is the caller graph for this function:

item* map_item ( void  )

Definition at line 611 of file item.c.

References map, new_item(), and item_struct::weight.

Referenced by init_client_vars().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int num_free_items ( void  )

Definition at line 444 of file item.c.

References item_struct::next.

Referenced by do_num_free_items().

+ Here is the caller graph for this function:

item* player_item ( void  )

Definition at line 606 of file item.c.

References new_item(), and player.

Referenced by init_client_vars().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void print_inventory ( item op)

Definition at line 654 of file item.c.

References item_struct::d_name, draw_info(), item_struct::flags, get_info_width(), item_struct::inv, MAX_BUF, NDI_BLACK, item_struct::next, item_struct::nrof, print_inventory(), item_struct::tag, and item_struct::weight.

Referenced by do_inv(), and print_inventory().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void remove_item_inventory ( item op)

Definition at line 382 of file item.c.

References item_struct::inv, item_struct::inv_updated, item_event_container_clearing(), and remove_item().

Referenced by DeleteInventory(), main(), and remove_item().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void send_mark_obj ( item op)

Definition at line 590 of file item.c.

References csocket, item_struct::env, ClientSocket::fd, MAX_BUF, script_monitor_str(), SockList_AddInt(), SockList_AddString(), SockList_Init(), SockList_Send(), and item_struct::tag.

Referenced by buttonpress_in_list(), list_button_event(), and list_item_action().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void set_flag_string ( item op)
static

Definition at line 462 of file item.c.

References apply_string, item_struct::apply_type, item_struct::cursed, item_struct::damned, item_struct::flags, item_struct::locked, item_struct::magical, item_struct::open, and item_struct::unpaid.

Referenced by get_flags().

+ Here is the caller graph for this function:

void set_item_values ( item op,
char *  name,
sint32  weight,
uint16  face,
uint16  flags,
uint16  anim,
uint16  animspeed,
uint32  nrof,
uint16  type 
)
void toggle_locked ( item op)

Definition at line 573 of file item.c.

References csocket, item_struct::env, ClientSocket::fd, item_struct::locked, MAX_BUF, script_monitor_str(), SockList_AddChar(), SockList_AddInt(), SockList_AddString(), SockList_Init(), SockList_Send(), and item_struct::tag.

Referenced by buttonpress_in_list(), list_button_event(), and list_item_action().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void update_item ( int  tag,
int  loc,
char *  name,
int  weight,
int  face,
int  flags,
int  anim,
int  animspeed,
uint32  nrof,
int  type 
)
void update_item_sort ( item it)

Definition at line 96 of file item.c.

References item_struct::applied, item_struct::env, insert_item_before_item(), item_struct::inv, item_struct::locked, item_struct::next, item_struct::prev, item_struct::s_name, and item_struct::type.

Referenced by set_item_values().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const char* const apply_string[]
static
Initial value:
= {
"", " (readied)", " (wielded)", " (worn)", " (active)", " (applied)",
}

Definition at line 458 of file item.c.

Referenced by set_flag_string().

item* free_items
static

Definition at line 33 of file item.c.

Referenced by create_new_item(), and remove_item().

item * map
static

Definition at line 34 of file item.c.

Referenced by locate_item(), and map_item().

item* player
static

Definition at line 34 of file item.c.

Referenced by player_item().

const char* const rcsid_common_item_c
Initial value:
=
"$Id: item.c 9201 2008-06-01 17:32:45Z anmaster $"

Definition at line 1 of file item.c.