ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/object.h
(Generate patch)

Comparing deliantra/server/include/object.h (file contents):
Revision 1.22 by root, Fri Sep 8 17:14:07 2006 UTC vs.
Revision 1.26 by root, Mon Sep 11 11:15:21 2006 UTC

79// these are not being copied 79// these are not being copied
80ACC_CLASS (object) 80ACC_CLASS (object)
81struct object_keep 81struct object_keep
82{ 82{
83 tag_t ACC (RW, count); /* Unique object number for this object */ 83 tag_t ACC (RW, count); /* Unique object number for this object */
84 uint16 ACC (RW, refcount); /* How many objects points to this object */ 84 sint32 ACC (RW, refcount); /* How many objects points to this object */
85 85
86 /* These variables are not changed by copy_object() */ 86 /* These variables are not changed by copy_object() */
87 struct pl *ACC (RW, contr); /* Pointer to the player which control this object */ 87 struct pl *ACC (RW, contr); /* Pointer to the player which control this object */
88 struct object *ACC (RW, next); /* Pointer to the next object in the free/used list */ 88 struct object *ACC (RW, next); /* Pointer to the next object in the free/used list */
89 struct object *ACC (RW, prev); /* Pointer to the previous object in the free/used list */ 89 struct object *ACC (RW, prev); /* Pointer to the previous object in the free/used list */
105 struct object *ACC (RW, head); /* Points to the main object of a large body */ 105 struct object *ACC (RW, head); /* Points to the main object of a large body */
106 struct mapstruct *ACC (RW, map); /* Pointer to the map in which this object is present */ 106 struct mapstruct *ACC (RW, map); /* Pointer to the map in which this object is present */
107}; 107};
108 108
109// these are being copied 109// these are being copied
110struct object_copy:attachable<object> 110struct object_copy : attachable<object>
111{ 111{
112 /* These get an extra add_refcount(), after having been copied by memcpy(). 112 /* These get an extra add_refcount(), after having been copied by memcpy().
113 * All fields beow this point are automatically copied by memcpy. If 113 * All fields beow this point are automatically copied by memcpy. If
114 * adding something that needs a refcount updated, make sure you modify 114 * adding something that needs a refcount updated, make sure you modify
115 * copy_object to do so. Everything below here also gets cleared 115 * copy_object to do so. Everything below here also gets cleared
151 uint32 ACC (RW, path_denied); /* Paths the object is denied access to */ 151 uint32 ACC (RW, path_denied); /* Paths the object is denied access to */
152 uint16 ACC (RW, material); /* What materials this object consist of */ 152 uint16 ACC (RW, material); /* What materials this object consist of */
153 sint8 ACC (RW, magic); /* Any magical bonuses to this item */ 153 sint8 ACC (RW, magic); /* Any magical bonuses to this item */
154 uint8 ACC (RW, state); /* How the object was last drawn (animation) */ 154 uint8 ACC (RW, state); /* How the object was last drawn (animation) */
155 sint32 ACC (RW, value); /* How much money it is worth (or contains) */ 155 sint32 ACC (RW, value); /* How much money it is worth (or contains) */
156 sint16 ACC (RW, level); /* Level of creature or object */
157 /* Note that the last_.. values are sometimes used for non obvious 156 /* Note that the last_.. values are sometimes used for non obvious
158 * meanings by some objects, eg, sp penalty, permanent exp. 157 * meanings by some objects, eg, sp penalty, permanent exp.
159 */ 158 */
160 sint32 ACC (RW, last_heal); /* Last healed. Depends on constitution */ 159 sint32 ACC (RW, last_heal); /* Last healed. Depends on constitution */
161 sint32 ACC (RW, last_sp); /* As last_heal, but for spell points */ 160 sint32 ACC (RW, last_sp); /* As last_heal, but for spell points */
162 sint16 ACC (RW, last_grace); /* as last_sp, except for grace */ 161 sint16 ACC (RW, last_grace); /* as last_sp, except for grace */
163 sint16 ACC (RW, last_eat); /* How long since we last ate */ 162 sint16 ACC (RW, last_eat); /* How long since we last ate */
164 sint16 ACC (RW, invisible); /* How much longer the object will be invis */ 163 sint16 ACC (RW, invisible); /* How much longer the object will be invis */
164 sint16 ACC (RW, level); /* Level of creature or object */
165 uint8 ACC (RW, pick_up); /* See crossfire.doc */ 165 uint8 ACC (RW, pick_up); /* See crossfire.doc */
166 sint8 ACC (RW, item_power); /* power rating of the object */ 166 sint8 ACC (RW, item_power); /* power rating of the object */
167 sint8 ACC (RW, gen_sp_armour); /* sp regen penalty this object has (was last_heal) */ 167 sint8 ACC (RW, gen_sp_armour); /* sp regen penalty this object has (was last_heal) */
168 sint8 ACC (RW, glow_radius); /* indicates the glow radius of the object */
168 sint32 ACC (RW, weight); /* Attributes of the object */ 169 sint32 ACC (RW, weight); /* Attributes of the object */
169 sint32 ACC (RW, weight_limit); /* Weight-limit of object */ 170 sint32 ACC (RW, weight_limit); /* Weight-limit of object */
170 sint32 ACC (RW, carrying); /* How much weight this object contains */ 171 sint32 ACC (RW, carrying); /* How much weight this object contains */
171 sint8 ACC (RW, glow_radius); /* indicates the glow radius of the object */
172 living ACC (RO, stats); /* Str, Con, Dex, etc */ 172 living ACC (RO, stats); /* Str, Con, Dex, etc */
173 sint64 ACC (RW, perm_exp); /* Permanent exp */ 173 sint64 ACC (RW, perm_exp); /* Permanent exp */
174 struct object *ACC (RW, current_weapon); /* Pointer to the weapon currently used */ 174 struct object *ACC (RW, current_weapon); /* Pointer to the weapon currently used */
175 uint32 ACC (RW, weapontype); /* type of weapon */ 175 uint32 ACC (RW, weapontype); /* type of weapon */
176 uint32 ACC (RW, tooltype); /* type of tool or build facility */ 176 uint32 ACC (RW, tooltype); /* type of tool or build facility */
177 sint8 body_info[NUM_BODY_LOCATIONS]; /* body info as loaded from the file */ 177 sint8 body_info[NUM_BODY_LOCATIONS]; /* body info as loaded from the file */
178 sint8 body_used[NUM_BODY_LOCATIONS]; /* Calculated value based on items equipped */ 178 sint8 body_used[NUM_BODY_LOCATIONS]; /* Calculated value based on items equipped */
179 uint8 ACC (RW, will_apply); /* See crossfire.doc */
179 /* See the doc/Developers/objects for more info about body locations */ 180 /* See the doc/Developers/objects for more info about body locations */
180 181
181 /* Following mostly refers to fields only used for monsters */ 182 /* Following mostly refers to fields only used for monsters */
182 struct object *ACC (RW, owner); /* Pointer to the object which controls this one */ 183 struct object *ACC (RW, owner); /* Pointer to the object which controls this one */
183 /* Owner should not be referred to directly - */ 184 /* Owner should not be referred to directly - */
186 /* has been freed) */ 187 /* has been freed) */
187 struct object *ACC (RW, enemy); /* Monster/player to follow even if not closest */ 188 struct object *ACC (RW, enemy); /* Monster/player to follow even if not closest */
188 struct object *ACC (RW, attacked_by); /* This object start to attack us! only player & monster */ 189 struct object *ACC (RW, attacked_by); /* This object start to attack us! only player & monster */
189 tag_t ACC (RW, attacked_by_count); /* the tag of attacker, so we can be sure */ 190 tag_t ACC (RW, attacked_by_count); /* the tag of attacker, so we can be sure */
190 struct treasureliststruct *ACC (RW, randomitems); /* Items to be generated */ 191 struct treasureliststruct *ACC (RW, randomitems); /* Items to be generated */
191 uint16 ACC (RW, run_away); /* Monster runs away if it's hp goes below this percentage. */
192 struct object *ACC (RW, chosen_skill); /* the skill chosen to use */ 192 struct object *ACC (RW, chosen_skill); /* the skill chosen to use */
193 uint32 ACC (RW, hide); /* The object is hidden, not invisible */ 193 uint32 ACC (RW, hide); /* The object is hidden, not invisible */
194 /* changes made by kholland@sunlab.cit.cornell.edu */ 194 /* changes made by kholland@sunlab.cit.cornell.edu */
195 /* allows different movement patterns for attackers */ 195 /* allows different movement patterns for attackers */
196 sint32 ACC (RW, move_status); /* What stage in attack mode */ 196 sint32 ACC (RW, move_status); /* What stage in attack mode */
197 uint16 ACC (RW, attack_movement); /* What kind of attack movement */ 197 uint16 ACC (RW, attack_movement); /* What kind of attack movement */
198 uint8 ACC (RW, will_apply); /* See crossfire.doc */ 198 uint16 ACC (RW, run_away); /* Monster runs away if it's hp goes below this percentage. */
199 struct object *ACC (RW, spellitem); /* Spell ability monster is choosing to use */ 199 struct object *ACC (RW, spellitem); /* Spell ability monster is choosing to use */
200 double ACC (RW, expmul); /* needed experience = (calc_exp*expmul) - means some */ 200 float ACC (RW, expmul); /* needed experience = (calc_exp*expmul) - means some */
201 /* races/classes can need less/more exp to gain levels */ 201 /* races/classes can need less/more exp to gain levels */
202 202
203 /* Spell related information, may be useful elsewhere 203 /* Spell related information, may be useful elsewhere
204 * Note that other fields are used - these files are basically 204 * Note that other fields are used - these files are basically
205 * only used in spells. 205 * only used in spells.
206 */ 206 */
207 sint16 ACC (RW, duration); /* How long the spell lasts */ 207 sint16 ACC (RW, duration); /* How long the spell lasts */
208 sint16 ACC (RW, casting_time); /* time left before spell goes off */
209 uint16 ACC (RW, start_holding);
210 struct object *ACC (RW, spell); /* Spell that was being cast */
211 char *ACC (RW, spellarg);
208 uint8 ACC (RW, duration_modifier); /* how level modifies duration */ 212 uint8 ACC (RW, duration_modifier); /* how level modifies duration */
209 sint16 ACC (RW, casting_time); /* time left before spell goes off */
210 struct object *ACC (RW, spell); /* Spell that was being cast */
211 uint16 ACC (RW, start_holding);
212 char *ACC (RW, spellarg);
213 uint8 ACC (RW, dam_modifier); /* How going up in level effects damage */ 213 uint8 ACC (RW, dam_modifier); /* How going up in level effects damage */
214 sint8 ACC (RW, range); /* Range of the spell */ 214 sint8 ACC (RW, range); /* Range of the spell */
215 uint8 ACC (RW, range_modifier); /* How going up in level effects range */ 215 uint8 ACC (RW, range_modifier); /* How going up in level effects range */
216 216
217 /* Following are values used by any object */ 217 /* Following are values used by any object */
233 MoveType ACC (RW, move_slow); /* Movement types this slows down */ 233 MoveType ACC (RW, move_slow); /* Movement types this slows down */
234 float ACC (RW, move_slow_penalty); /* How much this slows down the object */ 234 float ACC (RW, move_slow_penalty); /* How much this slows down the object */
235 key_value *key_values; /* Fields not explictly known by the loader. */ 235 key_value *key_values; /* Fields not explictly known by the loader. */
236}; 236};
237 237
238#define get_object() object::create ()
239#define free_object(op) (op)->free (0)
240#define free_object2(op, free_inv) (op)->free (free_inv)
241
238struct object : zero_initialised, object_keep, object_copy, object_pod 242struct object : zero_initialised, object_keep, object_copy, object_pod
239{ 243{
244 static object *create ();
245 void free (bool free_inventory = false);
246
247 static void free_mortals ();
248 static bool can_merge (object *op1, object *op2);
249
250 void clear ();
251 void clone (object *destination);
252
253protected:
254 friend struct archetype;
255
256 void link ();
257 void unlink ();
258
240 object (); 259 object ();
241 ~object (); 260 ~object ();
242
243 static bool can_merge (object * op1, object * op2);
244
245 void clear ();
246 void clone (object * destination);
247}; 261};
248
249#define get_object() (new object) // compatibility, but please keep for a while
250 262
251#define CAN_MERGE(op1,op2) ((op1)->value == (op2)->value && (op1)->name == (op2)->name && object::can_merge ((op1), (op2))) 263#define CAN_MERGE(op1,op2) ((op1)->value == (op2)->value && (op1)->name == (op2)->name && object::can_merge ((op1), (op2)))
252 264
253typedef struct oblnk 265typedef struct oblnk
254{ /* Used to link together several objects */ 266{ /* Used to link together several objects */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines