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.173 by root, Sun May 4 08:25:33 2008 UTC vs.
Revision 1.179 by root, Mon Jul 14 23:57:46 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
465 /* This return true if object has still randomitems which 467 /* This return true if object has still randomitems which
466 * could be expanded. 468 * could be expanded.
467 */ 469 */
468 MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; } 470 MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; }
469 471
472 MTH bool has_dialogue () const { return *&msg == '@'; }
473
470 // returns the outermost owner, never returns 0 474 // returns the outermost owner, never returns 0
471 MTH object *outer_owner () 475 MTH object *outer_owner ()
472 { 476 {
473 for (object *op = this; ; op = op->owner) 477 for (object *op = this; ; op = op->owner)
474 if (!op->owner) 478 if (!op->owner)
537 // set the given flag on all objects in the inventory recursively 541 // set the given flag on all objects in the inventory recursively
538 MTH void set_flag_inv (int flag, int value = 1); 542 MTH void set_flag_inv (int flag, int value = 1);
539 543
540 void enter_exit (object *exit);//Perl 544 void enter_exit (object *exit);//Perl
541 MTH void enter_map (maptile *newmap, int x, int y); 545 MTH void enter_map (maptile *newmap, int x, int y);
546 void player_goto (const char *path, int x, int y); // only for players
542 547
543 // returns the mapspace this object is in 548 // returns the mapspace this object is in
544 mapspace &ms () const; 549 mapspace &ms () const;
545 550
546 // fully recursive iterator 551 // fully recursive iterator
677 MTH static archetype *find (const_utf8_string name); 682 MTH static archetype *find (const_utf8_string name);
678 683
679 MTH void link (); 684 MTH void link ();
680 MTH void unlink (); 685 MTH void unlink ();
681 686
682 MTH static object *get (const char *name); // find()->instance() 687 MTH static object *get (const char *name); // (find() || singularity)->instance()
683 MTH object *instance (); 688 MTH object *instance ();
684 689
685 object_vector_index ACC (RW, archid); // index in archvector 690 object_vector_index ACC (RW, archid); // index in archvector
686 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ 691 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */
687 692
692 static archetype *read (object_thawer &f); 697 static archetype *read (object_thawer &f);
693 MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more 698 MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more
694 static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */ 699 static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */
695}; 700};
696 701
702// compatbiility, remove once replaced by ->instance
703inline object *
704arch_to_object (archetype *at)
705{
706 return at->instance ();
707}
708
697inline void 709inline void
698object_freezer::put (keyword k, archetype *v) 710object_freezer::put (keyword k, archetype *v)
699{ 711{
700 put (k, v ? &v->archname : (const char *)0); 712 put (k, v ? &v->archname : (const char *)0);
701} 713}
706 718
707extern objectvec objects; 719extern objectvec objects;
708extern activevec actives; 720extern activevec actives;
709extern archvec archetypes; 721extern archvec archetypes;
710 722
723// "safely" iterate over inv in a way such that the current item is removable
724// quite horrible, thats why its hidden in some macro
725#define for_inv_removable(op,var) \
726 for (object *var, *next_ = (op)->inv; (var = next_), var && (next_ = var->below), var; )
727
711#define for_all_objects(var) \ 728#define for_all_objects(var) \
712 for (unsigned _i = 0; _i < objects.size (); ++_i) \ 729 for (unsigned _i = 0; _i < objects.size (); ++_i) \
713 statementvar (object *, var, objects [_i]) 730 statementvar (object *, var, objects [_i])
714 731
715#define for_all_actives(var) \ 732#define for_all_actives(var) \
716 for (unsigned _i = 0; _i < actives.size (); ++_i) \ 733 for (unsigned _i = 0; _i < actives.size (); ++_i) \
717 statementvar (object *, var, actives [_i]) 734 statementvar (object *, var, actives [_i])
718 735
719#define for_all_archetypes(var) \ 736#define for_all_archetypes(var) \
720 for (unsigned _i = 0; _i < archetypes.size (); ++_i) \ 737 for (unsigned _i = 0; _i < archetypes.size (); ++_i) \
721 statementvar (archetype *, var, archetypes [_i]) 738 statementvar (archetype *, var, archetypes [_i])
722 739
723/* Used by update_object to know if the object being passed is 740/* Used by update_object to know if the object being passed is
724 * being added or removed. 741 * being added or removed.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines