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.100 by root, Mon Jan 1 12:28:45 2007 UTC vs.
Revision 1.104 by root, Tue Jan 2 21:13:21 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;
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}
2613object::flag_desc (char *desc, int len) const 2614object::flag_desc (char *desc, int len) const
2614{ 2615{
2615 char *p = desc; 2616 char *p = desc;
2616 bool first = true; 2617 bool first = true;
2617 2618
2619 *p = 0;
2620
2618 for (int i = 0; i < NUM_FLAGS; i++) 2621 for (int i = 0; i < NUM_FLAGS; i++)
2619 { 2622 {
2620 if (len <= 10) // magic constant! 2623 if (len <= 10) // magic constant!
2621 { 2624 {
2622 snprintf (p, len, ",..."); 2625 snprintf (p, len, ",...");
2623 break; 2626 break;
2624 } 2627 }
2625 2628
2626 if (flag[i]) 2629 if (flag [i])
2627 { 2630 {
2628 int cnt = snprintf (p, len, "%s%d", first ? "" : ",", i); 2631 int cnt = snprintf (p, len, "%s%d", first ? "" : ",", i);
2629 len -= cnt; 2632 len -= cnt;
2630 p += cnt; 2633 p += cnt;
2631 first = false; 2634 first = false;
2633 } 2636 }
2634 2637
2635 return desc; 2638 return desc;
2636} 2639}
2637 2640
2638// return a suitable string describing an objetc in enough detail to find it 2641// return a suitable string describing an object in enough detail to find it
2639const char * 2642const char *
2640object::debug_desc (char *info) const 2643object::debug_desc (char *info) const
2641{ 2644{
2642 char flagdesc[512]; 2645 char flagdesc[512];
2643 char info2[256 * 4]; 2646 char info2[256 * 4];
2660} 2663}
2661 2664
2662const char * 2665const char *
2663object::debug_desc () const 2666object::debug_desc () const
2664{ 2667{
2665 static char info[256 * 3]; 2668 static char info[256 * 4];
2666 return debug_desc (info); 2669 return debug_desc (info);
2667} 2670}
2668 2671

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines