… | |
… | |
29 | #include <stdio.h> |
29 | #include <stdio.h> |
30 | #include <sys/types.h> |
30 | #include <sys/types.h> |
31 | #include <sys/uio.h> |
31 | #include <sys/uio.h> |
32 | #include <object.h> |
32 | #include <object.h> |
33 | #include <funcpoint.h> |
33 | #include <funcpoint.h> |
|
|
34 | #include <sproto.h> |
34 | #include <loader.h> |
35 | #include <loader.h> |
35 | |
36 | |
36 | #include <bitset> |
37 | #include <bitset> |
37 | |
38 | |
38 | int nrofallocobjects = 0; |
39 | int nrofallocobjects = 0; |
… | |
… | |
449 | owner = owner->owner; |
450 | owner = owner->owner; |
450 | |
451 | |
451 | this->owner = owner; |
452 | this->owner = owner; |
452 | } |
453 | } |
453 | |
454 | |
|
|
455 | void |
|
|
456 | object::set_weapon (object *ob) |
|
|
457 | { |
|
|
458 | if (current_weapon == ob) |
|
|
459 | return; |
|
|
460 | |
|
|
461 | new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); |
|
|
462 | |
|
|
463 | if (chosen_skill) |
|
|
464 | chosen_skill->flag [FLAG_APPLIED] = false; |
|
|
465 | |
|
|
466 | current_weapon = ob; |
|
|
467 | chosen_skill = ob->type == SKILL ? ob : find_skill_by_name (this, ob->skill); |
|
|
468 | |
|
|
469 | if (chosen_skill) |
|
|
470 | chosen_skill->flag [FLAG_APPLIED] = true; |
|
|
471 | |
|
|
472 | update_stats (); |
|
|
473 | } |
|
|
474 | |
454 | /* Zero the key_values on op, decrementing the shared-string |
475 | /* Zero the key_values on op, decrementing the shared-string |
455 | * refcounts and freeing the links. |
476 | * refcounts and freeing the links. |
456 | */ |
477 | */ |
457 | static void |
478 | static void |
458 | free_key_values (object *op) |
479 | free_key_values (object *op) |
… | |
… | |
538 | * need for monsters, but doesn't hurt to do it for everything. |
559 | * need for monsters, but doesn't hurt to do it for everything. |
539 | * by doing so, when a monster is created, it has good starting |
560 | * by doing so, when a monster is created, it has good starting |
540 | * values for the body_used info, so when items are created |
561 | * values for the body_used info, so when items are created |
541 | * for it, they can be properly equipped. |
562 | * for it, they can be properly equipped. |
542 | */ |
563 | */ |
543 | memcpy (body_used, body_info, sizeof (body_used)); |
564 | for (int i = NUM_BODY_LOCATIONS; i--; ) |
|
|
565 | slot[i].used = slot[i].info; |
544 | |
566 | |
545 | attachable::instantiate (); |
567 | attachable::instantiate (); |
546 | } |
568 | } |
547 | |
569 | |
548 | object * |
570 | object * |
… | |
… | |
2584 | } |
2606 | } |
2585 | |
2607 | |
2586 | const char * |
2608 | const char * |
2587 | object::debug_desc () const |
2609 | object::debug_desc () const |
2588 | { |
2610 | { |
2589 | static char info[256 * 4]; |
2611 | static char info[3][256 * 4]; |
|
|
2612 | static int info_idx; |
|
|
2613 | |
2590 | return debug_desc (info); |
2614 | return debug_desc (info [++info_idx % 3]); |
2591 | } |
|
|
2592 | |
|
|
2593 | const char * |
|
|
2594 | object::debug_desc2 () const |
|
|
2595 | { |
|
|
2596 | static char info[256 * 4]; |
|
|
2597 | return debug_desc (info); |
|
|
2598 | } |
2615 | } |
2599 | |
2616 | |
2600 | struct region * |
2617 | struct region * |
2601 | object::region () const |
2618 | object::region () const |
2602 | { |
2619 | { |