… | |
… | |
120 | * This is typically the container that the object is in. |
120 | * This is typically the container that the object is in. |
121 | */ |
121 | */ |
122 | object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ |
122 | object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ |
123 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
123 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
124 | maptile *ACC (RW, map); /* Pointer to the map in which this object is present */ |
124 | maptile *ACC (RW, map); /* Pointer to the map in which this object is present */ |
|
|
125 | client_container *seen_by; // seen by which player/container currently? |
125 | }; |
126 | }; |
126 | |
127 | |
127 | // these are being copied |
128 | // these are being copied |
128 | struct object_copy : attachable<object> |
129 | struct object_copy : attachable<object> |
129 | { |
130 | { |
… | |
… | |
285 | |
286 | |
286 | // info must hold 256 * 3 bytes currently |
287 | // info must hold 256 * 3 bytes currently |
287 | const char *debug_desc (char *info) const; |
288 | const char *debug_desc (char *info) const; |
288 | const char *debug_desc () const; |
289 | const char *debug_desc () const; |
289 | |
290 | |
|
|
291 | bool is_weapon () const { return type == ARROW || type == BOW || type == WEAPON; } |
|
|
292 | bool is_armor () const { return type == ARMOUR || type == SHIELD || type == HELMET |
|
|
293 | || type == CLOAK || type == BOOTS || type == GLOVES |
|
|
294 | || type == BRACERS || type == GIRDLE; } |
|
|
295 | bool is_alive () const { return (type == PLAYER |
|
|
296 | || flags [FLAG_MONSTER] |
|
|
297 | || (flags [FLAG_ALIVE] && !flags [FLAG_GENERATOR] && type != DOOR)) |
|
|
298 | && !flags [FLAG_IS_A_TEMPLATE]; } |
|
|
299 | bool is_arrow () const { return type == ARROW |
|
|
300 | || (type == SPELL_EFFECT |
|
|
301 | && (subtype == SP_BULLET || subtype == SP_MAGIC_MISSILE)); } |
|
|
302 | |
|
|
303 | /* This return true if object has still randomitems which |
|
|
304 | * could be expanded. |
|
|
305 | */ |
|
|
306 | bool has_random_items () const { return randomitems && !flags [FLAG_IS_A_TEMPLATE]; } |
|
|
307 | |
|
|
308 | // returns the player that has this object in his inventory, or 0 |
|
|
309 | object *in_player () const |
|
|
310 | { |
|
|
311 | for (object *op = env; op; op = op->env) |
|
|
312 | if (op->type == PLAYER) |
|
|
313 | return op; |
|
|
314 | |
|
|
315 | return 0; |
|
|
316 | } |
|
|
317 | |
290 | // fully recursive iterator |
318 | // fully recursive iterator |
291 | struct iterator_base |
319 | struct iterator_base |
292 | { |
320 | { |
293 | object *item; |
321 | object *item; |
294 | |
322 | |
… | |
… | |
382 | extern int nrofallocobjects; |
410 | extern int nrofallocobjects; |
383 | |
411 | |
384 | /* This returns TRUE if the object is something that |
412 | /* This returns TRUE if the object is something that |
385 | * should be displayed in the look window |
413 | * should be displayed in the look window |
386 | */ |
414 | */ |
387 | #define LOOK_OBJ(ob) (!ob->invisible && ob->type!=PLAYER && ob->type!=EVENT_CONNECTOR) |
415 | #define LOOK_OBJ(ob) (!ob->invisible && ob->type != PLAYER && ob->type != EVENT_CONNECTOR) |
388 | |
416 | |
389 | /* Used by update_object to know if the object being passed is |
417 | /* Used by update_object to know if the object being passed is |
390 | * being added or removed. |
418 | * being added or removed. |
391 | */ |
419 | */ |
392 | #define UP_OBJ_INSERT 1 |
420 | #define UP_OBJ_INSERT 1 |