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.190 by root, Tue Dec 23 01:13:15 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
762extern objectvec objects; 770extern objectvec objects;
763extern activevec actives; 771extern activevec actives;
764extern archvec archetypes; 772extern archvec archetypes;
765 773
766// "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
767// quite horrible, thats why its hidden in some macro 775// quite horrible, that's why its hidden in some macro
768#define for_inv_removable(op,var) \ 776#define for_inv_removable(op,var) \
769 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; )
770 778
771#define for_all_objects(var) \ 779#define for_all_objects(var) \
772 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