… | |
… | |
306 | } |
306 | } |
307 | |
307 | |
308 | // return the dominant material of this item, always return something |
308 | // return the dominant material of this item, always return something |
309 | const materialtype_t *dominant_material () const; |
309 | const materialtype_t *dominant_material () const; |
310 | |
310 | |
|
|
311 | // return the volume of this object in cm³ |
311 | uint64 volume () const |
312 | uint64 volume () const |
312 | { |
313 | { |
313 | return total_weight () / dominant_material ()->density; |
314 | return total_weight () |
|
|
315 | * 1000 |
|
|
316 | * (type == CONTAINER ? 1000 : 1) |
|
|
317 | / dominant_material ()->density; |
314 | } |
318 | } |
315 | |
319 | |
316 | MTH bool is_weapon () const { return type == ARROW || type == BOW || type == WEAPON; } |
320 | MTH bool is_weapon () const { return type == ARROW || type == BOW || type == WEAPON; } |
317 | MTH bool is_armor () const { return type == ARMOUR || type == SHIELD || type == HELMET |
321 | MTH bool is_armor () const { return type == ARMOUR || type == SHIELD || type == HELMET |
318 | || type == CLOAK || type == BOOTS || type == GLOVES |
322 | || type == CLOAK || type == BOOTS || type == GLOVES |