ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/object.C
(Generate patch)

Comparing deliantra/server/common/object.C (file contents):
Revision 1.102 by root, Mon Jan 1 17:34:11 2007 UTC vs.
Revision 1.105 by pippijn, Wed Jan 3 00:21:35 2007 UTC

733void 733void
734object::activate_recursive () 734object::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
774void 774void
775object::deactivate_recursive () 775object::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;
1203 { 1204 {
1204 /* The part may be on a different map. */ 1205 /* The part may be on a different map. */
1205 1206
1206 object *more = op->more; 1207 object *more = op->more;
1207 1208
1208 /* We really need the caller to normalize coordinates - if 1209 /* We really need the caller to normalise coordinates - if
1209 * we set the map, that doesn't work if the location is within 1210 * we set the map, that doesn't work if the location is within
1210 * a map and this is straddling an edge. So only if coordinate 1211 * a map and this is straddling an edge. So only if coordinate
1211 * is clear wrong do we normalize it. 1212 * is clear wrong do we normalise it.
1212 */ 1213 */
1213 if (OUT_OF_REAL_MAP (more->map, more->x, more->y)) 1214 if (OUT_OF_REAL_MAP (more->map, more->x, more->y))
1214 more->map = get_map_from_coord (m, &more->x, &more->y); 1215 more->map = get_map_from_coord (m, &more->x, &more->y);
1215 else if (!more->map) 1216 else if (!more->map)
1216 { 1217 {
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 */
1846object * 1847object *
1847present_arch (const archetype *at, maptile *m, int x, int y) 1848present_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}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines