… | |
… | |
177 | |
177 | |
178 | float ACC (RW, speed); /* The overall speed of this object */ |
178 | float ACC (RW, speed); /* The overall speed of this object */ |
179 | float ACC (RW, speed_left); /* How much speed is left to spend this round */ |
179 | float ACC (RW, speed_left); /* How much speed is left to spend this round */ |
180 | uint32 ACC (RW, nrof); /* How many of the objects */ |
180 | uint32 ACC (RW, nrof); /* How many of the objects */ |
181 | |
181 | |
182 | /* This next big block are basically used for monsters and equipment */ |
182 | /* This next big block is basically used for monsters and equipment */ |
183 | uint16 ACC (RW, client_type); /* Public type information. see doc/Developers/objects */ |
183 | uint16 ACC (RW, client_type); /* Public type information. see doc/Developers/objects */ |
184 | |
184 | |
185 | sint16 ACC (RW, resist[NROFATTACKS]); /* Resistance adjustments for attacks */ |
185 | sint16 ACC (RW, resist[NROFATTACKS]); /* Resistance adjustments for attacks */ |
186 | uint32 ACC (RW, attacktype); /* Bitmask of attacks this object does */ |
186 | uint32 ACC (RW, attacktype); /* Bitmask of attacks this object does */ |
187 | uint32 ACC (RW, path_attuned);/* Paths the object is attuned to */ |
187 | uint32 ACC (RW, path_attuned);/* Paths the object is attuned to */ |
… | |
… | |
302 | bool write (object_freezer &f); |
302 | bool write (object_freezer &f); |
303 | |
303 | |
304 | MTH int slottype () const; |
304 | MTH int slottype () const; |
305 | MTH static object *create (); |
305 | MTH static object *create (); |
306 | const mapxy &operator =(const mapxy &pos); |
306 | const mapxy &operator =(const mapxy &pos); |
307 | object &operator =(const object &src); |
|
|
308 | MTH void copy_to (object *dst); |
307 | MTH void copy_to (object *dst); |
309 | MTH object *clone (); // create + copy_to |
308 | MTH object *clone (); // create + copy_to |
310 | void do_destroy (); |
309 | void do_destroy (); |
311 | void gather_callbacks (AV *&callbacks, event_type event) const; |
310 | void gather_callbacks (AV *&callbacks, event_type event) const; |
312 | MTH void destroy (bool destroy_inventory = false); |
311 | MTH void destroy (bool destroy_inventory = false); |
… | |
… | |
377 | // info must hold 256 * 3 bytes currently |
376 | // info must hold 256 * 3 bytes currently |
378 | const char *debug_desc (char *info) const; |
377 | const char *debug_desc (char *info) const; |
379 | MTH const char *debug_desc () const; // uses at least 3 round-robin buffers |
378 | MTH const char *debug_desc () const; // uses at least 3 round-robin buffers |
380 | const char *flag_desc (char *desc, int len) const; |
379 | const char *flag_desc (char *desc, int len) const; |
381 | |
380 | |
382 | MTH bool decrease_nr (sint32 nr); |
381 | MTH bool decrease (sint32 nr = 1); // returns true if anything is left |
383 | MTH object *split_nr (sint32 nr); |
382 | MTH object *split (sint32 nr = 1); // return 0 on failure |
384 | |
383 | |
385 | MTH int number_of () const |
384 | MTH int number_of () const |
386 | { |
385 | { |
387 | return nrof ? nrof : 1; |
386 | return nrof ? nrof : 1; |
388 | } |
387 | } |
… | |
… | |
430 | /* This return true if object has still randomitems which |
429 | /* This return true if object has still randomitems which |
431 | * could be expanded. |
430 | * could be expanded. |
432 | */ |
431 | */ |
433 | MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; } |
432 | MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; } |
434 | |
433 | |
|
|
434 | // returns the outermost owner, never returns 0 |
|
|
435 | MTH object *outer_owner () |
|
|
436 | { |
|
|
437 | for (object *op = this; ; op = op->owner) |
|
|
438 | if (!op->owner) |
|
|
439 | return op; |
|
|
440 | } |
|
|
441 | |
435 | // returns the outermost environment, never returns 0 |
442 | // returns the outermost environment, never returns 0 |
436 | MTH object *outer_env () |
443 | MTH object *outer_env () |
437 | { |
444 | { |
438 | for (object *op = this; ; op = op->env) |
445 | for (object *op = this; ; op = op->env) |
439 | if (!op->env) |
446 | if (!op->env) |
… | |
… | |
462 | |
469 | |
463 | MTH bool is_on_map () const |
470 | MTH bool is_on_map () const |
464 | { |
471 | { |
465 | return !env && !flag [FLAG_REMOVED]; |
472 | return !env && !flag [FLAG_REMOVED]; |
466 | } |
473 | } |
|
|
474 | |
|
|
475 | // returns the player that cna see this object, if any |
|
|
476 | MTH object *visible_to () const; |
467 | |
477 | |
468 | MTH std::string long_desc (object *who = 0); |
478 | MTH std::string long_desc (object *who = 0); |
469 | MTH std::string describe_monster (object *who = 0); |
479 | MTH std::string describe_monster (object *who = 0); |
470 | MTH std::string describe_item (object *who = 0); |
480 | MTH std::string describe_item (object *who = 0); |
471 | MTH std::string describe (object *who = 0); |
481 | MTH std::string describe (object *who = 0); |
… | |
… | |
536 | { |
546 | { |
537 | return this; |
547 | return this; |
538 | } |
548 | } |
539 | |
549 | |
540 | /* This returns TRUE if the object is something that |
550 | /* This returns TRUE if the object is something that |
541 | * should be displayed in the floorbox/inventory window |
551 | * a client might want to know about. |
542 | */ |
552 | */ |
543 | MTH bool client_visible () const |
553 | MTH bool client_visible () const |
544 | { |
554 | { |
545 | return !invisible && type != PLAYER; |
555 | return !invisible && type != PLAYER; |
|
|
556 | } |
|
|
557 | |
|
|
558 | // the client does nrof * this weight |
|
|
559 | MTH sint32 client_weight () const |
|
|
560 | { |
|
|
561 | return weight + carrying; |
546 | } |
562 | } |
547 | |
563 | |
548 | MTH struct region *region () const; |
564 | MTH struct region *region () const; |
549 | |
565 | |
550 | void statusmsg (const char *msg, int color = NDI_BLACK); |
566 | void statusmsg (const char *msg, int color = NDI_BLACK); |
… | |
… | |
559 | void link (); |
575 | void link (); |
560 | void unlink (); |
576 | void unlink (); |
561 | |
577 | |
562 | object (); |
578 | object (); |
563 | ~object (); |
579 | ~object (); |
|
|
580 | |
|
|
581 | private: |
|
|
582 | object &operator =(const object &); |
|
|
583 | object (const object &); |
564 | }; |
584 | }; |
565 | |
585 | |
566 | // move this object to the top of its env's inventory to speed up |
586 | // move this object to the top of its env's inventory to speed up |
567 | // searches for it. |
587 | // searches for it. |
568 | static object * |
588 | static object * |
… | |
… | |
621 | MTH static archetype *find (const_utf8_string name); |
641 | MTH static archetype *find (const_utf8_string name); |
622 | |
642 | |
623 | MTH void link (); |
643 | MTH void link (); |
624 | MTH void unlink (); |
644 | MTH void unlink (); |
625 | |
645 | |
|
|
646 | MTH static object *get (const char *name); // find()->instance() |
626 | MTH object *instance (); |
647 | MTH object *instance (); |
627 | |
648 | |
628 | object_vector_index ACC (RW, archid); // index in archvector |
649 | object_vector_index ACC (RW, archid); // index in archvector |
629 | shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ |
650 | shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ |
630 | |
651 | |