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.189 by root, Tue Dec 23 00:39:48 2008 UTC vs.
Revision 1.192 by root, Sun Dec 28 06:59:27 2008 UTC

383 remove (); 383 remove ();
384 *this = pos; 384 *this = pos;
385 insert_at (this, this); 385 insert_at (this, this);
386 } 386 }
387 387
388 // high-level move functions, return true if successful
389 int move (int dir, object *originator);
390
391 int move (int dir)
392 {
393 return move (dir, this);
394 }
395
388 static bool can_merge_slow (object *op1, object *op2); 396 static bool can_merge_slow (object *op1, object *op2);
389 397
390 // this is often used in time-critical code, so optimise 398 // this is often used in time-critical code, so optimise
391 MTH static bool can_merge (object *op1, object *op2) 399 MTH static bool can_merge (object *op1, object *op2)
392 { 400 {
451 const materialtype_t *dominant_material () const; 459 const materialtype_t *dominant_material () const;
452 460
453 // return the volume of this object in cm³ 461 // return the volume of this object in cm³
454 MTH uint64 volume () const 462 MTH uint64 volume () const
455 { 463 {
456 return total_weight () 464 return (uint64)total_weight ()
457 * 1000 465 * 1000
458 * (type == CONTAINER ? 1000 : 1) 466 * (type == CONTAINER ? 1000 : 1)
459 / dominant_material ()->density; 467 / dominant_material ()->density;
460 } 468 }
461 469
538 MTH bool is_inserted () const 546 MTH bool is_inserted () const
539 { 547 {
540 return !flag [FLAG_REMOVED]; 548 return !flag [FLAG_REMOVED];
541 } 549 }
542 550
551 MTH bool is_player () const
552 {
553 return !!contr;
554 }
555
543 MTH bool affects_los () const 556 MTH bool affects_los () const
544 { 557 {
545 return glow_radius || flag [FLAG_BLOCKSVIEW]; 558 return glow_radius || flag [FLAG_BLOCKSVIEW];
546 } 559 }
547 560
757extern objectvec objects; 770extern objectvec objects;
758extern activevec actives; 771extern activevec actives;
759extern archvec archetypes; 772extern archvec archetypes;
760 773
761// "safely" iterate over inv in a way such that the current item is removable 774// "safely" iterate over inv in a way such that the current item is removable
762// quite horrible, thats why its hidden in some macro 775// quite horrible, that's why its hidden in some macro
763#define for_inv_removable(op,var) \ 776#define for_inv_removable(op,var) \
764 for (object *var, *next_ = (op)->inv; (var = next_), var && (next_ = var->below), var; ) 777 for (object *var, *next_ = (op)->inv; (var = next_), var && (next_ = var->below), var; )
765 778
766#define for_all_objects(var) \ 779#define for_all_objects(var) \
767 for (unsigned _i = 0; _i < objects.size (); ++_i) \ 780 for (unsigned _i = 0; _i < objects.size (); ++_i) \

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines