… | |
… | |
229 | object *ACC (RW, above); /* Pointer to the object stacked above this one */ |
229 | object *ACC (RW, above); /* Pointer to the object stacked above this one */ |
230 | /* Note: stacked in the *same* environment */ |
230 | /* Note: stacked in the *same* environment */ |
231 | object *inv; /* Pointer to the first object in the inventory */ |
231 | object *inv; /* Pointer to the first object in the inventory */ |
232 | |
232 | |
233 | //TODO: container must move into client |
233 | //TODO: container must move into client |
234 | object *ACC (RW, container); /* Current container being used. I think this |
234 | object_ptr ACC (RW, container); /* Current container being used. I think this |
235 | * is only used by the player right now. |
235 | * is only used by the player right now. |
236 | */ |
236 | */ |
237 | object *ACC (RW, env); /* Pointer to the object which is the environment. |
237 | object *ACC (RW, env); /* Pointer to the object which is the environment. |
238 | * This is typically the container that the object is in. |
238 | * This is typically the container that the object is in. |
239 | */ |
239 | */ |
… | |
… | |
268 | && can_merge_slow (op1, op2); |
268 | && can_merge_slow (op1, op2); |
269 | } |
269 | } |
270 | |
270 | |
271 | MTH void set_owner (object *owner); |
271 | MTH void set_owner (object *owner); |
272 | MTH void set_speed (float speed); |
272 | MTH void set_speed (float speed); |
|
|
273 | |
|
|
274 | MTH void open_container (object *new_container); |
|
|
275 | MTH void close_container () |
|
|
276 | { |
|
|
277 | open_container (0); |
|
|
278 | } |
273 | |
279 | |
274 | MTH void instantiate () |
280 | MTH void instantiate () |
275 | { |
281 | { |
276 | if (!uuid.seq) // HACK |
282 | if (!uuid.seq) // HACK |
277 | uuid = gen_uuid (); |
283 | uuid = gen_uuid (); |
… | |
… | |
306 | } |
312 | } |
307 | |
313 | |
308 | // return the dominant material of this item, always return something |
314 | // return the dominant material of this item, always return something |
309 | const materialtype_t *dominant_material () const; |
315 | const materialtype_t *dominant_material () const; |
310 | |
316 | |
|
|
317 | // return the volume of this object in cm³ |
311 | uint64 volume () const |
318 | uint64 volume () const |
312 | { |
319 | { |
313 | return total_weight () / dominant_material ()->density; |
320 | return total_weight () |
|
|
321 | * 1000 |
|
|
322 | * (type == CONTAINER ? 1000 : 1) |
|
|
323 | / dominant_material ()->density; |
314 | } |
324 | } |
315 | |
325 | |
316 | MTH bool is_weapon () const { return type == ARROW || type == BOW || type == WEAPON; } |
326 | 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 |
327 | MTH bool is_armor () const { return type == ARMOUR || type == SHIELD || type == HELMET |
318 | || type == CLOAK || type == BOOTS || type == GLOVES |
328 | || type == CLOAK || type == BOOTS || type == GLOVES |