… | |
… | |
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 | |