… | |
… | |
184 | sint32 ACC (RW, carrying); /* How much weight this object contains */ |
184 | sint32 ACC (RW, carrying); /* How much weight this object contains */ |
185 | sint64 ACC (RW, perm_exp); /* Permanent exp */ |
185 | sint64 ACC (RW, perm_exp); /* Permanent exp */ |
186 | uint32 ACC (RW, weapontype); /* type of weapon */ |
186 | uint32 ACC (RW, weapontype); /* type of weapon */ |
187 | uint32 ACC (RW, tooltype); /* type of tool or build facility */ |
187 | uint32 ACC (RW, tooltype); /* type of tool or build facility */ |
188 | body_slot slot [NUM_BODY_LOCATIONS]; |
188 | body_slot slot [NUM_BODY_LOCATIONS]; |
189 | faceidx ACC (RW, face); /* Face with colors */ |
189 | faceidx ACC (RW, face); /* the graphical face */ |
|
|
190 | faceidx ACC (RW, sound); /* the sound face */ |
|
|
191 | faceidx ACC (RW, sound_destroy); /* played on destroy */ |
190 | living ACC (RO, stats); /* Str, Con, Dex, etc */ |
192 | living ACC (RO, stats); /* Str, Con, Dex, etc */ |
191 | /* See the pod/objects.pod for more info about body locations */ |
193 | /* See the pod/objects.pod for more info about body locations */ |
192 | |
194 | |
193 | /* Following mostly refers to fields only used for monsters */ |
195 | /* Following mostly refers to fields only used for monsters */ |
194 | uint32 ACC (RW, hide); /* The object is hidden, not invisible */ |
196 | uint32 ACC (RW, hide); /* The object is hidden, not invisible */ |
… | |
… | |
248 | UUID ACC (RW, uuid); // Unique Identifier, survives saves etc. |
250 | UUID ACC (RW, uuid); // Unique Identifier, survives saves etc. |
249 | int ACC (RO, count); |
251 | int ACC (RO, count); |
250 | object_vector_index ACC (RO, index); // index into objects |
252 | object_vector_index ACC (RO, index); // index into objects |
251 | object_vector_index ACC (RO, active); // index into actives |
253 | object_vector_index ACC (RO, active); // index into actives |
252 | |
254 | |
253 | player_ptr ACC (RW, contr); /* Pointer to the player which control this object */ |
255 | player_ptr ACC (RW, contr); /* Pointer to the player which control this object, ALWAYS set *iff* type == PLAYER */ |
254 | |
256 | |
255 | object *ACC (RW, below); /* Pointer to the object stacked below this one */ |
257 | object *ACC (RW, below); /* Pointer to the object stacked below this one */ |
256 | object *ACC (RW, above); /* Pointer to the object stacked above this one */ |
258 | object *ACC (RW, above); /* Pointer to the object stacked above this one */ |
257 | /* Note: stacked in the *same* environment */ |
259 | /* Note: stacked in the *same* environment */ |
258 | object *inv; /* Pointer to the first object in the inventory */ |
260 | object *inv; /* Pointer to the first object in the inventory */ |
… | |
… | |
268 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
270 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
269 | client_container *seen_by; // seen by which player/container currently? |
271 | client_container *seen_by; // seen by which player/container currently? |
270 | key_value *key_values; /* Fields not explictly known by the loader. */ |
272 | key_value *key_values; /* Fields not explictly known by the loader. */ |
271 | |
273 | |
272 | bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all |
274 | bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all |
273 | void post_load_check (); // do some adjustments after parsing |
275 | MTH void post_load_check (); // do some adjustments after parsing |
274 | static object *read (object_thawer &f, maptile *map = 0); // map argument due to toal design bogosity, must go. |
276 | static object *read (object_thawer &f, maptile *map = 0); // map argument due to toal design bogosity, must go. |
275 | bool write (object_freezer &f); |
277 | bool write (object_freezer &f); |
276 | |
278 | |
277 | MTH int slottype () const; |
279 | MTH int slottype () const; |
278 | MTH static object *create (); |
280 | MTH static object *create (); |
|
|
281 | const mapxy &operator =(const mapxy &pos); |
279 | object &operator =(const object &src); |
282 | object &operator =(const object &src); |
280 | MTH void copy_to (object *dst); |
283 | MTH void copy_to (object *dst); |
281 | MTH object *clone (); // create + copy_to |
284 | MTH object *clone (); // create + copy_to |
282 | void do_destroy (); |
285 | void do_destroy (); |
283 | void gather_callbacks (AV *&callbacks, event_type event) const; |
286 | void gather_callbacks (AV *&callbacks, event_type event) const; |
284 | MTH void destroy (bool destroy_inventory = false); |
287 | MTH void destroy (bool destroy_inventory = false); |
285 | |
288 | |
286 | // recursively destroy all objects in inventory, optionally dropping them to the ground instead |
289 | // recursively destroy all objects in inventory, optionally dropping them to the ground instead |
287 | MTH void destroy_inv (bool drop_to_ground = false); |
290 | MTH void destroy_inv (bool drop_to_ground = false); |
288 | MTH object *insert (object *item); // insert into inventory |
291 | MTH object *insert (object *item); // insert into inventory |
|
|
292 | MTH void play_sound (faceidx sound) const; |
|
|
293 | |
289 | void do_remove (); |
294 | void do_remove (); |
290 | MTH void remove () |
295 | MTH void remove () |
291 | { |
296 | { |
292 | if (!flag [FLAG_REMOVED]) |
297 | if (!flag [FLAG_REMOVED]) |
293 | do_remove (); |
298 | do_remove (); |
|
|
299 | } |
|
|
300 | |
|
|
301 | void move_to (const mapxy &pos) |
|
|
302 | { |
|
|
303 | remove (); |
|
|
304 | *this = pos; |
|
|
305 | insert_at (this, this); |
294 | } |
306 | } |
295 | |
307 | |
296 | static bool can_merge_slow (object *op1, object *op2); |
308 | static bool can_merge_slow (object *op1, object *op2); |
297 | |
309 | |
298 | // this is often used in time-critical code, so optimise |
310 | // this is often used in time-critical code, so optimise |
… | |
… | |
311 | MTH void open_container (object *new_container); |
323 | MTH void open_container (object *new_container); |
312 | MTH void close_container () |
324 | MTH void close_container () |
313 | { |
325 | { |
314 | open_container (0); |
326 | open_container (0); |
315 | } |
327 | } |
|
|
328 | |
|
|
329 | MTH object *force_find (const shstr name); |
|
|
330 | MTH void force_add (const shstr name, int duration = 0); |
316 | |
331 | |
317 | // overwrite the attachable should_invoke function with a version that also checks ev_want_type |
332 | // overwrite the attachable should_invoke function with a version that also checks ev_want_type |
318 | bool should_invoke (event_type event) |
333 | bool should_invoke (event_type event) |
319 | { |
334 | { |
320 | return ev_want_event [event] || ev_want_type [type] || cb; |
335 | return ev_want_event [event] || ev_want_type [type] || cb; |
… | |
… | |
376 | |
391 | |
377 | // temporary: wether the object can be saved in a map file |
392 | // temporary: wether the object can be saved in a map file |
378 | // contr => is a player |
393 | // contr => is a player |
379 | // head => only save head of a multitile object |
394 | // head => only save head of a multitile object |
380 | // owner => can not reference owner yet |
395 | // owner => can not reference owner yet |
381 | MTH bool can_map_save () const { return !contr && !head && !owner && !flag [FLAG_NO_MAP_SAVE]; } |
396 | MTH bool can_map_save () const { return !head && (!owner || owner->contr) && !contr && !flag [FLAG_NO_MAP_SAVE]; } |
382 | |
397 | |
383 | /* This return true if object has still randomitems which |
398 | /* This return true if object has still randomitems which |
384 | * could be expanded. |
399 | * could be expanded. |
385 | */ |
400 | */ |
386 | MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; } |
401 | MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; } |
… | |
… | |
420 | MTH void create_treasure (treasurelist *tl, int flags = 0); |
435 | MTH void create_treasure (treasurelist *tl, int flags = 0); |
421 | |
436 | |
422 | // insert object at same map position as 'where' |
437 | // insert object at same map position as 'where' |
423 | // handles both inventory and map "positions" |
438 | // handles both inventory and map "positions" |
424 | MTH object *insert_at (object *where, object *originator = 0, int flags = 0); |
439 | MTH object *insert_at (object *where, object *originator = 0, int flags = 0); |
|
|
440 | MTH void drop_unpaid_items (); |
425 | |
441 | |
426 | MTH void activate (); |
442 | MTH void activate (); |
427 | MTH void deactivate (); |
443 | MTH void deactivate (); |
428 | MTH void activate_recursive (); |
444 | MTH void activate_recursive (); |
429 | MTH void deactivate_recursive (); |
445 | MTH void deactivate_recursive (); |
… | |
… | |
484 | { |
500 | { |
485 | return !invisible && type != PLAYER; |
501 | return !invisible && type != PLAYER; |
486 | } |
502 | } |
487 | |
503 | |
488 | MTH struct region *region () const; |
504 | MTH struct region *region () const; |
|
|
505 | |
|
|
506 | void statusmsg (const char *msg, int color = NDI_BLACK); |
|
|
507 | void failmsg (const char *msg, int color = NDI_RED); |
|
|
508 | |
|
|
509 | MTH const_octet_string ref () const; // creates and returns a consistent persistent object reference |
|
|
510 | static object *deref (const_octet_string ref); // returns the object from the generated refreence, if possible |
489 | |
511 | |
490 | protected: |
512 | protected: |
491 | void link (); |
513 | void link (); |
492 | void unlink (); |
514 | void unlink (); |
493 | |
515 | |
… | |
… | |
546 | archetype (const char *name); |
568 | archetype (const char *name); |
547 | ~archetype (); |
569 | ~archetype (); |
548 | void gather_callbacks (AV *&callbacks, event_type event) const; |
570 | void gather_callbacks (AV *&callbacks, event_type event) const; |
549 | |
571 | |
550 | static archetype *read (object_thawer &f); |
572 | static archetype *read (object_thawer &f); |
|
|
573 | |
551 | static archetype *get (const char *name); // find or create |
574 | MTH static archetype *get (const_utf8_string name); // find or create |
552 | static archetype *find (const char *name); |
575 | MTH static archetype *find (const_utf8_string name); |
553 | |
576 | |
554 | void link (); |
577 | MTH void link (); |
555 | void unlink (); |
578 | MTH void unlink (); |
556 | |
579 | |
557 | object_vector_index ACC (RW, archid); // index in archvector |
580 | object_vector_index ACC (RW, archid); // index in archvector |
558 | shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ |
581 | shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ |
559 | bool ACC (RW, stub); // if true, this is an invalid archetype |
582 | bool ACC (RW, stub); // if true, this is an invalid archetype |
560 | uint32 ACC (RW, editable); /* editable flags (mainly for editor) */ |
|
|
561 | |
583 | |
562 | sint8 ACC (RW, min_x), ACC (RW, min_y); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */ |
584 | sint8 ACC (RW, min_x), ACC (RW, min_y); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */ |
563 | sint8 ACC (RW, max_x), ACC (RW, max_y); |
585 | sint8 ACC (RW, max_x), ACC (RW, max_y); |
564 | }; |
586 | }; |
565 | |
587 | |