Crossfire Client, Branches  R11627
item.h
Go to the documentation of this file.
1 /*
2  * static char *rcsid_item_h =
3  * "$Id: item.h 6716 2007-06-27 18:57:31Z akirschbaum $";
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 
27 #ifndef ITEM_H
28 #define ITEM_H
29 
30 /*
31  * Use static buffer for object names. Item names are changing so
32  * often that mallocing them it just a waste of time. Also there is
33  * probably some upper limits for names that client can show, Note
34  * that total number of items is small (<100) so this don't even
35  * waste too much memory
36  */
37 #define NAME_LEN 128
38 #define copy_name(t,f) strncpy(t, f, NAME_LEN-1); t[NAME_LEN-1]=0;
39 
40 #define NO_ITEM_TYPE 30000
41 /*
42  * item structure keeps all information what player
43  * (= client) knows about items in its inventory
44  */
45 typedef struct item_struct {
46  struct item_struct *next; /* next item in inventory */
47  struct item_struct *prev; /* previous item in inventory */
48  struct item_struct *env; /* which items inventory is this item */
49  struct item_struct *inv; /* items inventory */
50  char d_name[NAME_LEN]; /* item's full name w/o status information */
51  char s_name[NAME_LEN]; /* item's singular name as sent to us */
52  char p_name[NAME_LEN]; /* item's plural name as sent to us */
53  char flags[NAME_LEN]; /* item's status information */
54  sint32 tag; /* item identifier (0 = free) */
55  uint32 nrof; /* number of items */
56  float weight; /* how much item weights */
57  sint16 face; /* index for face array */
58  uint16 animation_id; /* Index into animation array */
59  uint8 anim_speed; /* how often to animate */
60  uint8 anim_state; /* last face in sequence drawn */
61  uint16 last_anim; /* how many ticks have passed since we last animated */
62  uint16 magical:1; /* item is magical */
63  uint16 cursed:1; /* item is cursed */
64  uint16 damned:1; /* item is damned */
65  uint16 unpaid:1; /* item is unpaid */
66  uint16 locked:1; /* item is locked */
67  uint16 applied:1; /* item is applied */
68  uint16 open:1; /* container is open */
69  uint16 was_open:1; /* container was open */
70  uint16 inv_updated:1; /* item's inventory is updated, this is set
71  when item's inventory is modified, draw
72  routines can use this to redraw things */
73  uint8 apply_type; /* how item is applied (worn/wield/etc) */
74  uint32 flagsval; /* unmodified flags value as sent from the server*/
75  uint16 type; /* Item type for ordering */
76 } item;
77 
78 /* Toolkits implement these. */
79 extern void item_event_item_deleting(item * it);
80 extern void item_event_container_clearing(item * container);
81 /* TODO More fine-grained event - but how to handle it? */
82 extern void item_event_item_changed(item * it);
83 extern int can_write_spell_on(item* it);
84 
85 #endif /* ITEM_H */
float weight
Definition: item.h:56
char s_name[NAME_LEN]
Definition: item.h:51
signed short sint16
Definition: client-types.h:80
#define NAME_LEN
Definition: item.h:37
char flags[NAME_LEN]
Definition: item.h:53
uint8 anim_speed
Definition: item.h:59
void item_event_container_clearing(item *container)
Definition: inventory.c:525
struct item_struct * env
Definition: item.h:48
void item_event_item_deleting(item *it)
Definition: inventory.c:596
struct item_struct * next
Definition: item.h:46
char p_name[NAME_LEN]
Definition: item.h:52
uint16 inv_updated
Definition: item.h:70
void item_event_item_changed(item *it)
Definition: inventory.c:489
uint16 applied
Definition: item.h:67
uint32 flagsval
Definition: item.h:74
struct item_struct item
uint16 locked
Definition: item.h:66
char d_name[NAME_LEN]
Definition: item.h:50
uint16 animation_id
Definition: item.h:58
sint32 tag
Definition: item.h:54
uint16 magical
Definition: item.h:62
unsigned short uint16
Definition: client-types.h:79
uint16 type
Definition: item.h:75
uint16 unpaid
Definition: item.h:65
uint8 anim_state
Definition: item.h:60
unsigned int uint32
Definition: client-types.h:77
uint16 open
Definition: item.h:68
uint16 was_open
Definition: item.h:69
signed int sint32
Definition: client-types.h:78
uint32 nrof
Definition: item.h:55
struct item_struct * prev
Definition: item.h:47
uint16 last_anim
Definition: item.h:61
unsigned char uint8
Definition: client-types.h:81
uint16 damned
Definition: item.h:64
struct item_struct * inv
Definition: item.h:49
uint8 apply_type
Definition: item.h:73
uint16 cursed
Definition: item.h:63
int can_write_spell_on(item *it)
Definition: item.c:752
sint16 face
Definition: item.h:57