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.178 by elmex, Sun Jun 15 19:34:31 2008 UTC

260 bool ACC (RW, flag[NUM_FLAGS]); 260 bool ACC (RW, flag[NUM_FLAGS]);
261#endif 261#endif
262 uint16 ACC (RW, animation_id);/* An index into the animation array */ 262 uint16 ACC (RW, animation_id);/* An index into the animation array */
263 uint8 ACC (RW, anim_speed); /* ticks between animation-frames */ 263 uint8 ACC (RW, anim_speed); /* ticks between animation-frames */
264 uint8 ACC (RW, last_anim); /* last sequence used to draw face */ 264 uint8 ACC (RW, last_anim); /* last sequence used to draw face */
265 sint16 ACC (RW, elevation); /* elevation of this terrain - not currently used */
266 uint8 ACC (RW, smoothlevel); /* how to smooth this square around */ 265 uint8 ACC (RW, smoothlevel); /* how to smooth this square around */
267 uint8 ACC (RW, will_apply); /* See crossfire.doc */ 266 uint8 ACC (RW, will_apply); /* See crossfire.doc */
267 uint16 ACC (RW, cached_sp); /* cached spell points used for a spell, used by esrv_update_spells */
268 uint16 ACC (RW, cached_grace);/* cached grace points used for a spell, used by esrv_update_spells */
269 uint16 ACC (RW, cached_eat); /* cached food, used by esrv_update_spells */
268}; 270};
269 271
270struct object : zero_initialised, object_copy 272struct object : zero_initialised, object_copy
271{ 273{
272 // These variables are not changed by ->copy_to 274 // These variables are not changed by ->copy_to
338 340
339 MTH int slottype () const; 341 MTH int slottype () const;
340 MTH static object *create (); 342 MTH static object *create ();
341 const mapxy &operator =(const mapxy &pos); 343 const mapxy &operator =(const mapxy &pos);
342 MTH void copy_to (object *dst); 344 MTH void copy_to (object *dst);
343 MTH object *clone (); // create + copy_to 345 MTH object *clone (); // create + copy_to a single object
346 MTH object *deep_clone (); // copy whole more chain and inventory
344 void do_destroy (); 347 void do_destroy ();
345 void gather_callbacks (AV *&callbacks, event_type event) const; 348 void gather_callbacks (AV *&callbacks, event_type event) const;
346 MTH void destroy (bool destroy_inventory = false); 349 MTH void destroy (bool destroy_inventory = false);
347 350
348 // recursively destroy all objects in inventory, optionally dropping them to the ground instead 351 // 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 539 // set the given flag on all objects in the inventory recursively
537 MTH void set_flag_inv (int flag, int value = 1); 540 MTH void set_flag_inv (int flag, int value = 1);
538 541
539 void enter_exit (object *exit);//Perl 542 void enter_exit (object *exit);//Perl
540 MTH void enter_map (maptile *newmap, int x, int y); 543 MTH void enter_map (maptile *newmap, int x, int y);
544 void player_goto (const char *path, int x, int y); // only for players
541 545
542 // returns the mapspace this object is in 546 // returns the mapspace this object is in
543 mapspace &ms () const; 547 mapspace &ms () const;
544 548
545 // fully recursive iterator 549 // fully recursive iterator
676 MTH static archetype *find (const_utf8_string name); 680 MTH static archetype *find (const_utf8_string name);
677 681
678 MTH void link (); 682 MTH void link ();
679 MTH void unlink (); 683 MTH void unlink ();
680 684
681 MTH static object *get (const char *name); // find()->instance() 685 MTH static object *get (const char *name); // (find() || singularity)->instance()
682 MTH object *instance (); 686 MTH object *instance ();
683 687
684 object_vector_index ACC (RW, archid); // index in archvector 688 object_vector_index ACC (RW, archid); // index in archvector
685 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ 689 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */
686 690
691 static archetype *read (object_thawer &f); 695 static archetype *read (object_thawer &f);
692 MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more 696 MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more
693 static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */ 697 static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */
694}; 698};
695 699
700// compatbiility, remove once replaced by ->instance
701inline object *
702arch_to_object (archetype *at)
703{
704 return at->instance ();
705}
706
696inline void 707inline void
697object_freezer::put (keyword k, archetype *v) 708object_freezer::put (keyword k, archetype *v)
698{ 709{
699 put (k, v ? &v->archname : (const char *)0); 710 put (k, v ? &v->archname : (const char *)0);
700} 711}
705 716
706extern objectvec objects; 717extern objectvec objects;
707extern activevec actives; 718extern activevec actives;
708extern archvec archetypes; 719extern archvec archetypes;
709 720
721// "safely" iterate over inv in a way such that the current item is removable
722// quite horrible, thats why its hidden in some macro
723#define for_inv_removable(op,var) \
724 for (object *var, *next_ = (op)->inv; (var = next_), var && (next_ = var->below), var; )
725
710#define for_all_objects(var) \ 726#define for_all_objects(var) \
711 for (unsigned _i = 0; _i < objects.size (); ++_i) \ 727 for (unsigned _i = 0; _i < objects.size (); ++_i) \
712 statementvar (object *, var, objects [_i]) 728 statementvar (object *, var, objects [_i])
713 729
714#define for_all_actives(var) \ 730#define for_all_actives(var) \
715 for (unsigned _i = 0; _i < actives.size (); ++_i) \ 731 for (unsigned _i = 0; _i < actives.size (); ++_i) \
716 statementvar (object *, var, actives [_i]) 732 statementvar (object *, var, actives [_i])
717 733
718#define for_all_archetypes(var) \ 734#define for_all_archetypes(var) \
719 for (unsigned _i = 0; _i < archetypes.size (); ++_i) \ 735 for (unsigned _i = 0; _i < archetypes.size (); ++_i) \
720 statementvar (archetype *, var, archetypes [_i]) 736 statementvar (archetype *, var, archetypes [_i])
721 737
722/* Used by update_object to know if the object being passed is 738/* Used by update_object to know if the object being passed is
723 * being added or removed. 739 * being added or removed.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines