Crossfire Client, Trunk  R20996
item.h
Go to the documentation of this file.
1 /*
2  * static char *rcsid_common_item_h =
3  * "$Id: item.h 20606 2018-10-26 01:21:11Z silvernexus $";
4  */
5 /*
6  Crossfire client, a client program for the crossfire program.
7 
8  Copyright (C) 2001 Mark Wedel & Crossfire Development Team
9 
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2 of the License, or
13  (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 
24  The author can be reached via e-mail to crossfire-devel@real-time.com
25 */
26 
32 #ifndef ITEM_H
33 #define ITEM_H
34 
35 /*
36  * Use static buffer for object names. Item names are changing so
37  * often that mallocing them it just a waste of time. Also there is
38  * probably some upper limits for names that client can show, Note
39  * that total number of items is small (<100) so this don't even
40  * waste too much memory
41  */
42 #define NAME_LEN 128
43 #define copy_name(t,f) strncpy(t, f, NAME_LEN-1); t[NAME_LEN-1]=0;
44 
45 #define NO_ITEM_TYPE 30000
46 /*
47  * item structure keeps all information what player
48  * (= client) knows about items in its inventory
49  */
50 typedef struct item_struct {
51  struct item_struct *next; /* next item in inventory */
52  struct item_struct *prev; /* previous item in inventory */
53  struct item_struct *env; /* which items inventory is this item */
54  struct item_struct *inv; /* items inventory */
55  char d_name[NAME_LEN]; /* item's full name w/o status information */
56  char s_name[NAME_LEN]; /* item's singular name as sent to us */
57  char p_name[NAME_LEN]; /* item's plural name as sent to us */
58  char flags[NAME_LEN]; /* item's status information */
59  gint32 tag; /* item identifier (0 = free) */
60  guint32 nrof; /* number of items */
61  float weight; /* how much item weights */
62  gint16 face; /* index for face array */
63  guint16 animation_id; /* Index into animation array */
64  guint8 anim_speed; /* how often to animate */
65  guint8 anim_state; /* last face in sequence drawn */
66  guint16 last_anim; /* how many ticks have passed since we last animated */
67  guint16 magical:1; /* item is magical */
68  guint16 cursed:1; /* item is cursed */
69  guint16 damned:1; /* item is damned */
70  guint16 blessed:1; /* item is blessed */
71  guint16 unpaid:1; /* item is unpaid */
72  guint16 locked:1; /* item is locked */
73  guint16 applied:1; /* item is applied */
74  guint16 open:1; /* container is open */
75  guint16 was_open:1; /* container was open */
76  guint16 inv_updated:1; /* item's inventory is updated, this is set
77  when item's inventory is modified, draw
78  routines can use this to redraw things */
79  guint8 apply_type; /* how item is applied (worn/wield/etc) */
80  guint32 flagsval; /* unmodified flags value as sent from the server*/
81  guint16 type; /* Item type for ordering */
82 } item;
83 
84 /* Toolkits implement these. */
85 extern void item_event_item_deleting(item * it);
86 extern void item_event_container_clearing(item * container);
87 /* TODO More fine-grained event - but how to handle it? */
88 extern void item_event_item_changed(item * it);
89 extern int can_write_spell_on(item* it);
90 
91 #endif /* ITEM_H */
float weight
Definition: item.h:61
char s_name[NAME_LEN]
Definition: item.h:56
#define NAME_LEN
Definition: item.h:42
char flags[NAME_LEN]
Definition: item.h:58
guint16 inv_updated
Definition: item.h:76
void item_event_container_clearing(item *container)
Definition: inventory.c:673
struct item_struct * env
Definition: item.h:53
void item_event_item_deleting(item *it)
Definition: inventory.c:670
struct item_struct * next
Definition: item.h:51
char p_name[NAME_LEN]
Definition: item.h:57
gint32 tag
Definition: item.h:59
guint32 nrof
Definition: item.h:60
guint16 locked
Definition: item.h:72
void item_event_item_changed(item *it)
Definition: inventory.c:676
guint16 type
Definition: item.h:81
struct item_struct item
char d_name[NAME_LEN]
Definition: item.h:55
guint16 last_anim
Definition: item.h:66
guint16 was_open
Definition: item.h:75
guint32 flagsval
Definition: item.h:80
guint8 apply_type
Definition: item.h:79
guint16 animation_id
Definition: item.h:63
guint8 anim_speed
Definition: item.h:64
guint16 unpaid
Definition: item.h:71
guint16 open
Definition: item.h:74
struct item_struct * prev
Definition: item.h:52
guint16 damned
Definition: item.h:69
guint16 cursed
Definition: item.h:68
guint16 magical
Definition: item.h:67
guint16 applied
Definition: item.h:73
guint16 blessed
Definition: item.h:70
gint16 face
Definition: item.h:62
guint8 anim_state
Definition: item.h:65
struct item_struct * inv
Definition: item.h:54
int can_write_spell_on(item *it)
Definition: item.c:786