… | |
… | |
733 | void |
733 | void |
734 | object::activate_recursive () |
734 | object::activate_recursive () |
735 | { |
735 | { |
736 | activate (); |
736 | activate (); |
737 | |
737 | |
738 | for (object *op = inv; op; op = op->above) |
738 | for (object *op = inv; op; op = op->below) |
739 | op->activate_recursive (); |
739 | op->activate_recursive (); |
740 | } |
740 | } |
741 | |
741 | |
742 | /* This function removes object 'op' from the list of active |
742 | /* This function removes object 'op' from the list of active |
743 | * objects. |
743 | * objects. |
… | |
… | |
772 | } |
772 | } |
773 | |
773 | |
774 | void |
774 | void |
775 | object::deactivate_recursive () |
775 | object::deactivate_recursive () |
776 | { |
776 | { |
777 | for (object *op = inv; op; op = op->above) |
777 | for (object *op = inv; op; op = op->below) |
778 | op->deactivate_recursive (); |
778 | op->deactivate_recursive (); |
779 | |
779 | |
780 | deactivate (); |
780 | deactivate (); |
781 | } |
781 | } |
782 | |
782 | |
… | |
… | |
1444 | { |
1444 | { |
1445 | object *tmp, *tmp1; |
1445 | object *tmp, *tmp1; |
1446 | |
1446 | |
1447 | /* first search for itself and remove any old instances */ |
1447 | /* first search for itself and remove any old instances */ |
1448 | |
1448 | |
1449 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
1449 | for (tmp = op->ms ().bot; tmp; tmp = tmp->above) |
1450 | if (!strcmp (tmp->arch->name, arch_string)) /* same archetype */ |
1450 | if (!strcmp (tmp->arch->name, arch_string)) /* same archetype */ |
1451 | tmp->destroy (); |
1451 | tmp->destroy (); |
1452 | |
1452 | |
1453 | tmp1 = arch_to_object (archetype::find (arch_string)); |
1453 | tmp1 = arch_to_object (archetype::find (arch_string)); |
1454 | |
1454 | |
… | |
… | |
1777 | |
1777 | |
1778 | /* The objects have to be checked from top to bottom. |
1778 | /* The objects have to be checked from top to bottom. |
1779 | * Hence, we first go to the top: |
1779 | * Hence, we first go to the top: |
1780 | */ |
1780 | */ |
1781 | |
1781 | |
1782 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp && tmp->above; tmp = tmp->above) |
1782 | for (tmp = op->ms ().bot; tmp && tmp->above; tmp = tmp->above) |
1783 | { |
1783 | { |
1784 | /* Trim the search when we find the first other spell effect |
1784 | /* Trim the search when we find the first other spell effect |
1785 | * this helps performance so that if a space has 50 spell objects, |
1785 | * this helps performance so that if a space has 50 spell objects, |
1786 | * we don't need to check all of them. |
1786 | * we don't need to check all of them. |
1787 | */ |
1787 | */ |
… | |
… | |
1845 | * The first matching object is returned, or NULL if none. |
1845 | * The first matching object is returned, or NULL if none. |
1846 | */ |
1846 | */ |
1847 | object * |
1847 | object * |
1848 | present_arch (const archetype *at, maptile *m, int x, int y) |
1848 | present_arch (const archetype *at, maptile *m, int x, int y) |
1849 | { |
1849 | { |
1850 | if (m == NULL || out_of_map (m, x, y)) |
1850 | if (!m || out_of_map (m, x, y)) |
1851 | { |
1851 | { |
1852 | LOG (llevError, "Present_arch called outside map.\n"); |
1852 | LOG (llevError, "Present_arch called outside map.\n"); |
1853 | return NULL; |
1853 | return NULL; |
1854 | } |
1854 | } |
1855 | |
1855 | |
1856 | for (object *tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above) |
1856 | for (object *tmp = m->at (x, y).bot; tmp; tmp = tmp->above) |
1857 | if (tmp->arch == at) |
1857 | if (tmp->arch == at) |
1858 | return tmp; |
1858 | return tmp; |
1859 | |
1859 | |
1860 | return NULL; |
1860 | return NULL; |
1861 | } |
1861 | } |
… | |
… | |
1872 | { |
1872 | { |
1873 | LOG (llevError, "Present called outside map.\n"); |
1873 | LOG (llevError, "Present called outside map.\n"); |
1874 | return NULL; |
1874 | return NULL; |
1875 | } |
1875 | } |
1876 | |
1876 | |
1877 | for (object *tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above) |
1877 | for (object *tmp = m->at (x, y).bot; tmp; tmp = tmp->above) |
1878 | if (tmp->type == type) |
1878 | if (tmp->type == type) |
1879 | return tmp; |
1879 | return tmp; |
1880 | |
1880 | |
1881 | return NULL; |
1881 | return NULL; |
1882 | } |
1882 | } |