… | |
… | |
623 | /* |
623 | /* |
624 | * Updates the speed of an object. If the speed changes from 0 to another |
624 | * Updates the speed of an object. If the speed changes from 0 to another |
625 | * value, or vice versa, then add/remove the object from the active list. |
625 | * value, or vice versa, then add/remove the object from the active list. |
626 | * This function needs to be called whenever the speed of an object changes. |
626 | * This function needs to be called whenever the speed of an object changes. |
627 | */ |
627 | */ |
628 | |
|
|
629 | void |
628 | void |
630 | update_ob_speed (object *op) |
629 | update_ob_speed (object *op) |
631 | { |
630 | { |
632 | extern int arch_init; |
631 | extern int arch_init; |
633 | |
632 | |
… | |
… | |
642 | abort (); |
641 | abort (); |
643 | #else |
642 | #else |
644 | op->speed = 0; |
643 | op->speed = 0; |
645 | #endif |
644 | #endif |
646 | } |
645 | } |
|
|
646 | |
647 | if (arch_init) |
647 | if (arch_init) |
648 | { |
|
|
649 | return; |
648 | return; |
650 | } |
649 | |
651 | if (FABS (op->speed) > MIN_ACTIVE_SPEED) |
650 | if (FABS (op->speed) > MIN_ACTIVE_SPEED) |
652 | { |
651 | { |
653 | /* If already on active list, don't do anything */ |
652 | /* If already on active list, don't do anything */ |
654 | if (op->active_next || op->active_prev || op == active_objects) |
653 | if (op->active_next || op->active_prev || op == active_objects) |
655 | return; |
654 | return; |
656 | |
655 | |
657 | /* process_events() expects us to insert the object at the beginning |
656 | /* process_events() expects us to insert the object at the beginning |
658 | * of the list. */ |
657 | * of the list. */ |
659 | op->active_next = active_objects; |
658 | op->active_next = active_objects; |
|
|
659 | |
660 | if (op->active_next != NULL) |
660 | if (op->active_next != NULL) |
661 | op->active_next->active_prev = op; |
661 | op->active_next->active_prev = op; |
|
|
662 | |
662 | active_objects = op; |
663 | active_objects = op; |
663 | } |
664 | } |
664 | else |
665 | else |
665 | { |
666 | { |
666 | /* If not on the active list, nothing needs to be done */ |
667 | /* If not on the active list, nothing needs to be done */ |
… | |
… | |
668 | return; |
669 | return; |
669 | |
670 | |
670 | if (op->active_prev == NULL) |
671 | if (op->active_prev == NULL) |
671 | { |
672 | { |
672 | active_objects = op->active_next; |
673 | active_objects = op->active_next; |
|
|
674 | |
673 | if (op->active_next != NULL) |
675 | if (op->active_next != NULL) |
674 | op->active_next->active_prev = NULL; |
676 | op->active_next->active_prev = NULL; |
675 | } |
677 | } |
676 | else |
678 | else |
677 | { |
679 | { |
678 | op->active_prev->active_next = op->active_next; |
680 | op->active_prev->active_next = op->active_next; |
|
|
681 | |
679 | if (op->active_next) |
682 | if (op->active_next) |
680 | op->active_next->active_prev = op->active_prev; |
683 | op->active_next->active_prev = op->active_prev; |
681 | } |
684 | } |
|
|
685 | |
682 | op->active_next = NULL; |
686 | op->active_next = NULL; |
683 | op->active_prev = NULL; |
687 | op->active_prev = NULL; |
684 | } |
688 | } |
685 | } |
689 | } |
686 | |
690 | |
… | |
… | |
2840 | { |
2844 | { |
2841 | shstr key_ (key); |
2845 | shstr key_ (key); |
2842 | |
2846 | |
2843 | return set_ob_key_value_s (op, key_, value, add_key); |
2847 | return set_ob_key_value_s (op, key_, value, add_key); |
2844 | } |
2848 | } |
|
|
2849 | |
|
|
2850 | void |
|
|
2851 | object::deep_iterator::next () |
|
|
2852 | { |
|
|
2853 | if (item->inv) |
|
|
2854 | item = item->inv; |
|
|
2855 | else if (item->below) |
|
|
2856 | item = item->below; |
|
|
2857 | else |
|
|
2858 | item = item->env->below; |
|
|
2859 | } |