Crossfire Client, Trunk
item.h
Go to the documentation of this file.
1
/*
2
* static char *rcsid_common_item_h =
3
* "$Id$";
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
read
:1;
/* book has been read */
77
guint16
inv_updated
:1;
/* item's inventory is updated, this is set
78
when item's inventory is modified, draw
79
routines can use this to redraw things */
80
guint8
apply_type
;
/* how item is applied (worn/wield/etc) */
81
guint32
flagsval
;
/* unmodified flags value as sent from the server*/
82
guint16
type
;
/* Item type for ordering */
83
}
item
;
84
85
/* Toolkits implement these. */
86
extern
void
item_event_item_deleting
(
item
* it);
87
extern
void
item_event_container_clearing
(
item
* container);
88
/* TODO More fine-grained event - but how to handle it? */
89
extern
void
item_event_item_changed
(
item
* it);
90
extern
int
can_write_spell_on
(
item
* it);
91
92
#endif
/* ITEM_H */
item_event_container_clearing
void item_event_container_clearing(item *container)
Definition:
inventory.c:773
item_struct::inv
struct item_struct * inv
Definition:
item.h:54
item_struct::animation_id
guint16 animation_id
Definition:
item.h:63
item_struct::p_name
char p_name[NAME_LEN]
Definition:
item.h:57
item_struct::flagsval
guint32 flagsval
Definition:
item.h:81
item_struct::apply_type
guint8 apply_type
Definition:
item.h:80
item_struct::env
struct item_struct * env
Definition:
item.h:53
item_struct::applied
guint16 applied
Definition:
item.h:73
item_struct::damned
guint16 damned
Definition:
item.h:69
item_struct::last_anim
guint16 last_anim
Definition:
item.h:66
item_struct::nrof
guint32 nrof
Definition:
item.h:60
can_write_spell_on
int can_write_spell_on(item *it)
Definition:
item.c:720
item
struct item_struct item
item_struct::prev
struct item_struct * prev
Definition:
item.h:52
item_struct::open
guint16 open
Definition:
item.h:74
item_struct::face
gint16 face
Definition:
item.h:62
item_struct::unpaid
guint16 unpaid
Definition:
item.h:71
item_struct::flags
char flags[NAME_LEN]
Definition:
item.h:58
item_struct::cursed
guint16 cursed
Definition:
item.h:68
item_struct::magical
guint16 magical
Definition:
item.h:67
item_struct::next
struct item_struct * next
Definition:
item.h:51
item_struct::anim_speed
guint8 anim_speed
Definition:
item.h:64
item_struct::was_open
guint16 was_open
Definition:
item.h:75
item_struct
Definition:
item.h:50
item_struct::type
guint16 type
Definition:
item.h:82
item_struct::tag
gint32 tag
Definition:
item.h:59
item_struct::s_name
char s_name[NAME_LEN]
Definition:
item.h:56
item_struct::inv_updated
guint16 inv_updated
Definition:
item.h:77
item_struct::d_name
char d_name[NAME_LEN]
Definition:
item.h:55
item_struct::weight
float weight
Definition:
item.h:61
item_struct::blessed
guint16 blessed
Definition:
item.h:70
item_event_item_deleting
void item_event_item_deleting(item *it)
Definition:
inventory.c:760
NAME_LEN
#define NAME_LEN
Definition:
item.h:42
item_struct::locked
guint16 locked
Definition:
item.h:72
item_struct::anim_state
guint8 anim_state
Definition:
item.h:65
item_event_item_changed
void item_event_item_changed(item *it)
Definition:
inventory.c:776
item_struct::read
guint16 read
Definition:
item.h:76
crossfire-crossfire-client
common
item.h
Generated by
1.8.17