… | |
… | |
589 | if (slot [body_combat].info) return slot_combat; |
589 | if (slot [body_combat].info) return slot_combat; |
590 | if (slot [body_range ].info) return slot_ranged; |
590 | if (slot [body_range ].info) return slot_ranged; |
591 | } |
591 | } |
592 | |
592 | |
593 | return slot_none; |
593 | return slot_none; |
594 | } |
|
|
595 | |
|
|
596 | bool |
|
|
597 | object::change_weapon (object *ob) |
|
|
598 | { |
|
|
599 | if (current_weapon == ob) |
|
|
600 | return true; |
|
|
601 | |
|
|
602 | if (current_weapon && current_weapon->flag [FLAG_APPLIED]) |
|
|
603 | { |
|
|
604 | manual_apply (this, current_weapon, AP_UNAPPLY); |
|
|
605 | |
|
|
606 | if (current_weapon && !current_weapon->flag [FLAG_APPLIED])//D |
|
|
607 | LOG (llevError, "FATAL: did not clear current_weapon (%s)\n", current_weapon->debug_desc ()); |
|
|
608 | |
|
|
609 | if (current_weapon && current_weapon->flag [FLAG_APPLIED]) |
|
|
610 | return false; |
|
|
611 | } |
|
|
612 | |
|
|
613 | current_weapon = 0; |
|
|
614 | |
|
|
615 | if (ob && !ob->flag [FLAG_APPLIED]) |
|
|
616 | { |
|
|
617 | manual_apply (this, ob, AP_APPLY); |
|
|
618 | |
|
|
619 | if (ob->flag [FLAG_APPLIED]) |
|
|
620 | current_weapon = ob; |
|
|
621 | else |
|
|
622 | return false; |
|
|
623 | } |
|
|
624 | |
|
|
625 | return true; |
|
|
626 | } |
594 | } |
627 | |
595 | |
628 | /* Zero the key_values on op, decrementing the shared-string |
596 | /* Zero the key_values on op, decrementing the shared-string |
629 | * refcounts and freeing the links. |
597 | * refcounts and freeing the links. |
630 | */ |
598 | */ |