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.178 by elmex, Sun Jun 15 19:34:31 2008 UTC vs.
Revision 1.184 by root, Mon Sep 29 10:31:32 2008 UTC

175 arch_ptr ACC (RW, arch); /* Pointer to archetype */ 175 arch_ptr ACC (RW, arch); /* Pointer to archetype */
176 arch_ptr ACC (RW, other_arch);/* Pointer used for various things - mostly used for what */ 176 arch_ptr ACC (RW, other_arch);/* Pointer used for various things - mostly used for what */
177 177
178 float ACC (RW, speed); /* The overall speed of this object */ 178 float ACC (RW, speed); /* The overall speed of this object */
179 float ACC (RW, speed_left); /* How much speed is left to spend this round */ 179 float ACC (RW, speed_left); /* How much speed is left to spend this round */
180 uint32 ACC (RW, nrof); /* How many of the objects */ 180 sint32 ACC (RW, nrof); /* How many of the objects */
181 181
182 /* This next big block is basically used for monsters and equipment */ 182 /* This next big block is basically used for monsters and equipment */
183 uint16 ACC (RW, client_type); /* Public type information. see doc/Developers/objects */ 183 uint16 ACC (RW, client_type); /* Public type information. see doc/Developers/objects */
184 184
185 sint16 ACC (RW, resist[NROFATTACKS]); /* Resistance adjustments for attacks */ 185 sint16 ACC (RW, resist[NROFATTACKS]); /* Resistance adjustments for attacks */
270}; 270};
271 271
272struct object : zero_initialised, object_copy 272struct object : zero_initialised, object_copy
273{ 273{
274 // These variables are not changed by ->copy_to 274 // These variables are not changed by ->copy_to
275 maptile_ptr ACC (RW, map); /* Pointer to the map in which this object is present */ 275 maptile *ACC (RW, map); /* Pointer to the map in which this object is present */
276 276
277 UUID ACC (RW, uuid); // Unique Identifier, survives saves etc. 277 UUID ACC (RW, uuid); // Unique Identifier, survives saves etc.
278 int ACC (RO, count); 278 int ACC (RO, count);
279 object_vector_index ACC (RO, index); // index into objects 279 object_vector_index ACC (RO, index); // index into objects
280 object_vector_index ACC (RO, active); // index into actives 280 object_vector_index ACC (RO, active); // index into actives
345 MTH object *clone (); // create + copy_to a single object 345 MTH object *clone (); // create + copy_to a single object
346 MTH object *deep_clone (); // copy whole more chain and inventory 346 MTH object *deep_clone (); // copy whole more chain and inventory
347 void do_destroy (); 347 void do_destroy ();
348 void gather_callbacks (AV *&callbacks, event_type event) const; 348 void gather_callbacks (AV *&callbacks, event_type event) const;
349 MTH void destroy (bool destroy_inventory = false); 349 MTH void destroy (bool destroy_inventory = false);
350 MTH void drop_and_destroy ()
351 {
352 destroy_inv (true);
353 destroy ();
354 }
350 355
351 // recursively destroy all objects in inventory, optionally dropping them to the ground instead 356 // recursively destroy all objects in inventory, optionally dropping them to the ground instead
352 MTH void destroy_inv (bool drop_to_ground = false); 357 MTH void destroy_inv (bool drop_to_ground = false);
353 MTH object *insert (object *item); // insert into inventory 358 MTH object *insert (object *item); // insert into inventory
354 MTH void play_sound (faceidx sound); 359 MTH void play_sound (faceidx sound);
441 * 1000 446 * 1000
442 * (type == CONTAINER ? 1000 : 1) 447 * (type == CONTAINER ? 1000 : 1)
443 / dominant_material ()->density; 448 / dominant_material ()->density;
444 } 449 }
445 450
451 MTH bool is_wiz () const { return flag [FLAG_WIZ]; }
446 MTH bool is_weapon () const { return type == ARROW || type == BOW || type == WEAPON; } 452 MTH bool is_weapon () const { return type == ARROW || type == BOW || type == WEAPON; }
447 MTH bool is_armor () const { return type == ARMOUR || type == SHIELD || type == HELMET 453 MTH bool is_armor () const { return type == ARMOUR || type == SHIELD || type == HELMET
448 || type == CLOAK || type == BOOTS || type == GLOVES 454 || type == CLOAK || type == BOOTS || type == GLOVES
449 || type == BRACERS || type == GIRDLE; } 455 || type == BRACERS || type == GIRDLE; }
450 MTH bool is_alive () const { return (type == PLAYER 456 MTH bool is_alive () const { return (type == PLAYER
467 /* This return true if object has still randomitems which 473 /* This return true if object has still randomitems which
468 * could be expanded. 474 * could be expanded.
469 */ 475 */
470 MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; } 476 MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; }
471 477
478 MTH bool has_dialogue () const { return *&msg == '@'; }
479
472 // returns the outermost owner, never returns 0 480 // returns the outermost owner, never returns 0
473 MTH object *outer_owner () 481 MTH object *outer_owner ()
474 { 482 {
483 object *op;
484
475 for (object *op = this; ; op = op->owner) 485 for (op = this; op->owner; op = op->owner)
476 if (!op->owner) 486 ;
487
477 return op; 488 return op;
478 } 489 }
479 490
480 // returns the outermost environment, never returns 0 491 // returns the outermost environment, never returns 0
481 MTH object *outer_env () 492 MTH object *outer_env ()
482 { 493 {
494 object *op;
495
483 for (object *op = this; ; op = op->env) 496 for (op = this; op->env; op = op->env)
484 if (!op->env) 497 ;
498
485 return op; 499 return op;
486 } 500 }
487 501
488 // returns the player that has this object in his inventory, or 0 502 // returns the player that has this object in his inventory, or 0
489 // we assume the player is always the outer env 503 // we assume the player is always the outer env
490 MTH object *in_player () 504 MTH object *in_player ()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines