… | |
… | |
521 | MTH int number_of () const |
521 | MTH int number_of () const |
522 | { |
522 | { |
523 | return nrof ? nrof : 1; |
523 | return nrof ? nrof : 1; |
524 | } |
524 | } |
525 | |
525 | |
526 | MTH sint32 total_weight () const |
526 | MTH weight_t total_weight () const |
527 | { |
527 | { |
528 | return (weight + carrying) * number_of (); |
528 | return sint64 (weight + carrying) * number_of (); |
529 | } |
529 | } |
530 | |
530 | |
531 | MTH void update_weight (); |
531 | MTH void update_weight (); |
532 | |
532 | |
533 | // return the dominant material of this item, always return something |
533 | // return the dominant material of this item, always return something |
… | |
… | |
535 | { |
535 | { |
536 | return material; |
536 | return material; |
537 | } |
537 | } |
538 | |
538 | |
539 | // return the volume of this object in cm³ |
539 | // return the volume of this object in cm³ |
540 | MTH uint64 volume () const |
540 | MTH volume_t volume () const |
541 | { |
541 | { |
542 | return (uint64)total_weight () |
542 | return (volume_t)total_weight () |
543 | * 1024 // 1000 actually |
543 | * 1024 // 1000 actually |
544 | * (type == CONTAINER ? 128 : 1) |
544 | * (type == CONTAINER ? 128 : 1) |
545 | / dominant_material ()->density; // ugh, division |
545 | / dominant_material ()->density; // ugh, division |
546 | } |
546 | } |
547 | |
547 | |