… | |
… | |
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 | |
… | |
… | |
870 | freed_map->name = "/internal/freed_objects_map"; |
870 | freed_map->name = "/internal/freed_objects_map"; |
871 | freed_map->width = 3; |
871 | freed_map->width = 3; |
872 | freed_map->height = 3; |
872 | freed_map->height = 3; |
873 | |
873 | |
874 | freed_map->alloc (); |
874 | freed_map->alloc (); |
|
|
875 | freed_map->in_memory = MAP_IN_MEMORY; |
875 | } |
876 | } |
876 | |
877 | |
877 | map = freed_map; |
878 | map = freed_map; |
878 | x = 1; |
879 | x = 1; |
879 | y = 1; |
880 | y = 1; |
… | |
… | |
1443 | { |
1444 | { |
1444 | object *tmp, *tmp1; |
1445 | object *tmp, *tmp1; |
1445 | |
1446 | |
1446 | /* first search for itself and remove any old instances */ |
1447 | /* first search for itself and remove any old instances */ |
1447 | |
1448 | |
1448 | 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) |
1449 | if (!strcmp (tmp->arch->name, arch_string)) /* same archetype */ |
1450 | if (!strcmp (tmp->arch->name, arch_string)) /* same archetype */ |
1450 | tmp->destroy (); |
1451 | tmp->destroy (); |
1451 | |
1452 | |
1452 | tmp1 = arch_to_object (archetype::find (arch_string)); |
1453 | tmp1 = arch_to_object (archetype::find (arch_string)); |
1453 | |
1454 | |
… | |
… | |
1776 | |
1777 | |
1777 | /* The objects have to be checked from top to bottom. |
1778 | /* The objects have to be checked from top to bottom. |
1778 | * Hence, we first go to the top: |
1779 | * Hence, we first go to the top: |
1779 | */ |
1780 | */ |
1780 | |
1781 | |
1781 | 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) |
1782 | { |
1783 | { |
1783 | /* Trim the search when we find the first other spell effect |
1784 | /* Trim the search when we find the first other spell effect |
1784 | * 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, |
1785 | * we don't need to check all of them. |
1786 | * we don't need to check all of them. |
1786 | */ |
1787 | */ |
… | |
… | |
1844 | * The first matching object is returned, or NULL if none. |
1845 | * The first matching object is returned, or NULL if none. |
1845 | */ |
1846 | */ |
1846 | object * |
1847 | object * |
1847 | present_arch (const archetype *at, maptile *m, int x, int y) |
1848 | present_arch (const archetype *at, maptile *m, int x, int y) |
1848 | { |
1849 | { |
1849 | if (m == NULL || out_of_map (m, x, y)) |
1850 | if (!m || out_of_map (m, x, y)) |
1850 | { |
1851 | { |
1851 | LOG (llevError, "Present_arch called outside map.\n"); |
1852 | LOG (llevError, "Present_arch called outside map.\n"); |
1852 | return NULL; |
1853 | return NULL; |
1853 | } |
1854 | } |
1854 | |
1855 | |
1855 | 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) |
1856 | if (tmp->arch == at) |
1857 | if (tmp->arch == at) |
1857 | return tmp; |
1858 | return tmp; |
1858 | |
1859 | |
1859 | return NULL; |
1860 | return NULL; |
1860 | } |
1861 | } |
… | |
… | |
1871 | { |
1872 | { |
1872 | LOG (llevError, "Present called outside map.\n"); |
1873 | LOG (llevError, "Present called outside map.\n"); |
1873 | return NULL; |
1874 | return NULL; |
1874 | } |
1875 | } |
1875 | |
1876 | |
1876 | 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) |
1877 | if (tmp->type == type) |
1878 | if (tmp->type == type) |
1878 | return tmp; |
1879 | return tmp; |
1879 | |
1880 | |
1880 | return NULL; |
1881 | return NULL; |
1881 | } |
1882 | } |