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.172 by root, Sat May 3 11:14:50 2008 UTC vs.
Revision 1.176 by root, Mon May 5 15:54:39 2008 UTC

338 338
339 MTH int slottype () const; 339 MTH int slottype () const;
340 MTH static object *create (); 340 MTH static object *create ();
341 const mapxy &operator =(const mapxy &pos); 341 const mapxy &operator =(const mapxy &pos);
342 MTH void copy_to (object *dst); 342 MTH void copy_to (object *dst);
343 MTH object *clone (); // create + copy_to 343 MTH object *clone (); // create + copy_to a single object
344 MTH object *deep_clone (); // copy whole more chain and inventory
344 void do_destroy (); 345 void do_destroy ();
345 void gather_callbacks (AV *&callbacks, event_type event) const; 346 void gather_callbacks (AV *&callbacks, event_type event) const;
346 MTH void destroy (bool destroy_inventory = false); 347 MTH void destroy (bool destroy_inventory = false);
347 348
348 // recursively destroy all objects in inventory, optionally dropping them to the ground instead 349 // recursively destroy all objects in inventory, optionally dropping them to the ground instead
536 // set the given flag on all objects in the inventory recursively 537 // set the given flag on all objects in the inventory recursively
537 MTH void set_flag_inv (int flag, int value = 1); 538 MTH void set_flag_inv (int flag, int value = 1);
538 539
539 void enter_exit (object *exit);//Perl 540 void enter_exit (object *exit);//Perl
540 MTH void enter_map (maptile *newmap, int x, int y); 541 MTH void enter_map (maptile *newmap, int x, int y);
542 void player_goto (const char *path, int x, int y); // only for players
541 543
542 // returns the mapspace this object is in 544 // returns the mapspace this object is in
543 mapspace &ms () const; 545 mapspace &ms () const;
544 546
545 // fully recursive iterator 547 // fully recursive iterator
676 MTH static archetype *find (const_utf8_string name); 678 MTH static archetype *find (const_utf8_string name);
677 679
678 MTH void link (); 680 MTH void link ();
679 MTH void unlink (); 681 MTH void unlink ();
680 682
681 MTH static object *get (const char *name); // find()->instance() 683 MTH static object *get (const char *name); // (find() || singularity)->instance()
682 MTH object *instance (); 684 MTH object *instance ();
683 685
684 object_vector_index ACC (RW, archid); // index in archvector 686 object_vector_index ACC (RW, archid); // index in archvector
685 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ 687 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */
686 688
705 707
706extern objectvec objects; 708extern objectvec objects;
707extern activevec actives; 709extern activevec actives;
708extern archvec archetypes; 710extern archvec archetypes;
709 711
712// "safely" iterate over inv in a way such that the current item is removable
713// quite horrible, thats why its hidden in some macro
714#define for_inv_removable(op,var) \
715 for (object *var, *next_ = (op)->inv; (var = next_), var && (next_ = var->below), var; )
716
710#define for_all_objects(var) \ 717#define for_all_objects(var) \
711 for (unsigned _i = 0; _i < objects.size (); ++_i) \ 718 for (unsigned _i = 0; _i < objects.size (); ++_i) \
712 statementvar (object *, var, objects [_i]) 719 statementvar (object *, var, objects [_i])
713 720
714#define for_all_actives(var) \ 721#define for_all_actives(var) \
715 for (unsigned _i = 0; _i < actives.size (); ++_i) \ 722 for (unsigned _i = 0; _i < actives.size (); ++_i) \
716 statementvar (object *, var, actives [_i]) 723 statementvar (object *, var, actives [_i])
717 724
718#define for_all_archetypes(var) \ 725#define for_all_archetypes(var) \
719 for (unsigned _i = 0; _i < archetypes.size (); ++_i) \ 726 for (unsigned _i = 0; _i < archetypes.size (); ++_i) \
720 statementvar (archetype *, var, archetypes [_i]) 727 statementvar (archetype *, var, archetypes [_i])
721 728
722/* Used by update_object to know if the object being passed is 729/* Used by update_object to know if the object being passed is
723 * being added or removed. 730 * being added or removed.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines