Crossfire Client, Trunk  R20789
item.c File Reference
#include "client.h"
#include <ctype.h>
#include "external.h"
#include "item.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, gint32 tag)
 
void free_all_items (item *op)
 
static void get_flags (item *op, guint16 flags)
 
const char * get_number (guint32 i)
 
guint8 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 (gint32 tag)
 
static itemlocate_item_from_item (item *op, gint32 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, gint32 weight, guint16 face, guint16 flags, guint16 anim, guint16 animspeed, guint32 nrof, guint16 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, guint32 nrof, int type)
 
void update_item_sort (item *it)
 

Variables

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

Detailed Description

Provides functions that process items in various ways.

Definition in file item.c.

Macro Definition Documentation

◆ NROF_ITEMS

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

Definition at line 31 of file item.c.

Referenced by create_new_item().

Function Documentation

◆ add_item()

static void add_item ( item env,
item op 
)
static

Definition at line 410 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:

◆ alloc_items()

static item* alloc_items ( int  nrof)
static

Definition at line 246 of file item.c.

References 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:

◆ animate_objects()

◆ can_write_spell_on()

int can_write_spell_on ( item it)

Definition at line 782 of file item.c.

References item_struct::type.

◆ create_new_item()

item* create_new_item ( item env,
gint32  tag 
)

Definition at line 435 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:

◆ free_all_items()

void free_all_items ( item op)

Definition at line 264 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:

◆ get_flags()

static void get_flags ( item op,
guint16  flags 
)
static

◆ get_number()

const char* get_number ( guint32  i)

Definition at line 190 of file item.c.

References MAX_BUF.

Referenced by set_item_values().

+ Here is the caller graph for this function:

◆ get_type_from_name()

guint8 get_type_from_name ( const char *  name)

Definition at line 42 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:

◆ inscribe_magical_scroll()

void inscribe_magical_scroll ( item scroll,
Spell spell 
)

◆ insert_item_before_item()

static void insert_item_before_item ( item newitem,
item before 
)
static

Definition at line 72 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:

◆ locate_item()

item* locate_item ( gint32  tag)

Definition at line 300 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(), hide_main_client(), update_item(), and UpdateItemCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ locate_item_from_item()

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

Definition at line 281 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:

◆ map_item()

item* map_item ( void  )

Definition at line 637 of file item.c.

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

Referenced by client_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ new_item()

◆ num_free_items()

int num_free_items ( void  )

Definition at line 458 of file item.c.

References item_struct::next.

Referenced by do_num_free_items().

+ Here is the caller graph for this function:

◆ player_item()

item* player_item ( void  )

Definition at line 631 of file item.c.

References new_item(), and player.

Referenced by client_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_inventory()

void print_inventory ( item op)

Definition at line 682 of file item.c.

References item_struct::d_name, draw_ext_info(), item_struct::flags, get_info_width(), item_struct::inv, MAX_BUF, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_DEBUG, 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:

◆ remove_item()

◆ remove_item_inventory()

void remove_item_inventory ( item op)

Definition at line 393 of file item.c.

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_mark_obj()

void send_mark_obj ( item op)

Definition at line 614 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 list_item_action().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_flag_string()

static void set_flag_string ( item op)
static

◆ set_item_values()

void set_item_values ( item op,
char *  name,
gint32  weight,
guint16  face,
guint16  flags,
guint16  anim,
guint16  animspeed,
guint32  nrof,
guint16  type 
)

◆ toggle_locked()

void toggle_locked ( item op)

Definition at line 596 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 list_item_action().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_item()

void update_item ( int  tag,
int  loc,
char *  name,
int  weight,
int  face,
int  flags,
int  anim,
int  animspeed,
guint32  nrof,
int  type 
)

◆ update_item_sort()

void update_item_sort ( item it)

Definition at line 91 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

◆ apply_string

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

Definition at line 473 of file item.c.

Referenced by set_flag_string().

◆ free_items

item* free_items
static

Definition at line 27 of file item.c.

Referenced by create_new_item(), and remove_item().

◆ map

item * map
static

Definition at line 28 of file item.c.

Referenced by AccountPlayersCmd(), locate_item(), and map_item().

◆ player

item* player
static

Definition at line 28 of file item.c.

Referenced by player_item().