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.218 by root, Mon Nov 9 03:08:24 2009 UTC vs.
Revision 1.222 by root, Sun Nov 29 09:41:28 2009 UTC

165 flags_t flag; /* various flags */ 165 flags_t flag; /* various flags */
166#if FOR_PERL 166#if FOR_PERL
167 bool ACC (RW, flag[NUM_FLAGS]); 167 bool ACC (RW, flag[NUM_FLAGS]);
168#endif 168#endif
169 169
170 shstr ACC (RW, materialname); /* specific material name */ 170 materialtype_t *material; // What material this object consists of //TODO, make perl-accessible
171 shstr ACC (RW, skill); /* Name of the skill this object uses/grants */ 171 shstr ACC (RW, skill); /* Name of the skill this object uses/grants */
172// materialtype_t *ACC (RW, material); /* What material this object consists of */
173 object_ptr ACC (RW, owner); /* Pointer to the object which controls this one */ 172 object_ptr ACC (RW, owner); /* Pointer to the object which controls this one */
174 object_ptr ACC (RW, enemy); /* Monster/player to follow even if not closest */ 173 object_ptr ACC (RW, enemy); /* Monster/player to follow even if not closest */
175 object_ptr ACC (RW, attacked_by); /* This object start to attack us! only player & monster */ 174 object_ptr ACC (RW, attacked_by); /* This object start to attack us! only player & monster */
176 object_ptr ACC (RW, chosen_skill); /* the skill chosen to use */ 175 object_ptr ACC (RW, chosen_skill); /* the skill chosen to use */
177 object_ptr ACC (RW, spellitem); /* Spell ability monster is choosing to use */ 176 object_ptr ACC (RW, spellitem); /* Spell ability monster is choosing to use */
489 } 488 }
490 489
491 MTH void update_weight (); 490 MTH void update_weight ();
492 491
493 // return the dominant material of this item, always return something 492 // return the dominant material of this item, always return something
494 const materialtype_t *dominant_material () const; 493 const materialtype_t *dominant_material () const
494 {
495 return material;
496 }
495 497
496 // return the volume of this object in cm³ 498 // return the volume of this object in cm³
497 MTH uint64 volume () const 499 MTH uint64 volume () const
498 { 500 {
499 return (uint64)total_weight () 501 return (uint64)total_weight ()
500 * 1000 502 * 1024 // 1000 actually
501 * (type == CONTAINER ? 1000 : 1) 503 * (type == CONTAINER ? 128 : 1)
502 / dominant_material ()->density; 504 / dominant_material ()->density; // ugh, division
503 } 505 }
504 506
505 MTH bool is_arch () const { return this == (const object *)(const archetype *)arch; } 507 MTH bool is_arch () const { return this == (const object *)(const archetype *)arch; }
506 508
507 MTH bool is_wiz () const { return flag [FLAG_WIZ]; } 509 MTH bool is_wiz () const { return flag [FLAG_WIZ]; }
516 MTH bool is_arrow () const { return type == ARROW 518 MTH bool is_arrow () const { return type == ARROW
517 || (type == SPELL_EFFECT 519 || (type == SPELL_EFFECT
518 && (subtype == SP_BULLET || subtype == SP_MAGIC_MISSILE)); } 520 && (subtype == SP_BULLET || subtype == SP_MAGIC_MISSILE)); }
519 MTH bool is_range () const { return type == BOW || type == ROD || type == WAND || type == HORN; } 521 MTH bool is_range () const { return type == BOW || type == ROD || type == WAND || type == HORN; }
520 522
521 MTH bool has_active_speed () const { return fabs (speed) >= MIN_ACTIVE_SPEED; } 523 MTH bool has_active_speed () const { return speed >= MIN_ACTIVE_SPEED; }
522 524
523 // temporary: wether the object can be saved in a map file 525 // temporary: wether the object can be saved in a map file
524 // contr => is a player 526 // contr => is a player
525 // head => only save head of a multitile object 527 // head => only save head of a multitile object
526 // owner => can not reference owner yet 528 // owner => can not reference owner yet
821{ 823{
822 return at->instance (); 824 return at->instance ();
823} 825}
824 826
825inline void 827inline void
826object_freezer::put (keyword k, archetype *v) 828object_freezer::put (const keyword_string k, archetype *v)
827{ 829{
828 put (k, v ? &v->archname : (const char *)0); 830 if (expect_true (v))
831 put (k, v->archname);
832 else
833 put (k);
829} 834}
830 835
831typedef object_vector<object, &object::index > objectvec; 836typedef object_vector<object, &object::index > objectvec;
832typedef object_vector<object, &object::active> activevec; 837typedef object_vector<object, &object::active> activevec;
833typedef object_vector<archetype, &archetype::archid> archvec; 838typedef object_vector<archetype, &archetype::archid> archvec;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines