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.122 by root, Wed Jan 24 22:42:48 2007 UTC vs.
Revision 1.128 by root, Mon Feb 5 01:24:45 2007 UTC

819 819
820 if (flag [FLAG_IS_LINKED]) 820 if (flag [FLAG_IS_LINKED])
821 remove_button_link (this); 821 remove_button_link (this);
822 822
823 if (flag [FLAG_FRIENDLY]) 823 if (flag [FLAG_FRIENDLY])
824 {
824 remove_friendly_object (this); 825 remove_friendly_object (this);
826
827 if (type == GOLEM
828 && owner
829 && owner->type == PLAYER
830 && owner->contr->ranges[range_golem] == this)
831 owner->contr->ranges[range_golem] = 0;
832 }
825 833
826 if (!flag [FLAG_REMOVED]) 834 if (!flag [FLAG_REMOVED])
827 remove (); 835 remove ();
828 836
829 destroy_inv (true); 837 destroy_inv (true);
901 * This function removes the object op from the linked list of objects 909 * This function removes the object op from the linked list of objects
902 * which it is currently tied to. When this function is done, the 910 * which it is currently tied to. When this function is done, the
903 * object will have no environment. If the object previously had an 911 * object will have no environment. If the object previously had an
904 * environment, the x and y coordinates will be updated to 912 * environment, the x and y coordinates will be updated to
905 * the previous environment. 913 * the previous environment.
906 * Beware: This function is called from the editor as well!
907 */ 914 */
908void 915void
909object::remove_slow () 916object::do_remove ()
910{ 917{
911 object *tmp, *last = 0; 918 object *tmp, *last = 0;
912 object *otmp; 919 object *otmp;
913 920
914 if (QUERY_FLAG (this, FLAG_REMOVED)) 921 if (QUERY_FLAG (this, FLAG_REMOVED))
1968 } 1975 }
1969 1976
1970 if (!index) 1977 if (!index)
1971 return -1; 1978 return -1;
1972 1979
1973 return altern[RANDOM () % index]; 1980 return altern [rndm (index)];
1974} 1981}
1975 1982
1976/* 1983/*
1977 * find_first_free_spot(archetype, maptile, x, y) works like 1984 * find_first_free_spot(archetype, maptile, x, y) works like
1978 * find_free_spot(), but it will search max number of squares. 1985 * find_free_spot(), but it will search max number of squares.
1999{ 2006{
2000 arr += begin; 2007 arr += begin;
2001 end -= begin; 2008 end -= begin;
2002 2009
2003 while (--end) 2010 while (--end)
2004 swap (arr [end], arr [RANDOM () % (end + 1)]); 2011 swap (arr [end], arr [rndm (end + 1)]);
2005} 2012}
2006 2013
2007/* new function to make monster searching more efficient, and effective! 2014/* new function to make monster searching more efficient, and effective!
2008 * This basically returns a randomized array (in the passed pointer) of 2015 * This basically returns a randomized array (in the passed pointer) of
2009 * the spaces to find monsters. In this way, it won't always look for 2016 * the spaces to find monsters. In this way, it won't always look for
2571{ 2578{
2572 char flagdesc[512]; 2579 char flagdesc[512];
2573 char info2[256 * 4]; 2580 char info2[256 * 4];
2574 char *p = info; 2581 char *p = info;
2575 2582
2576 p += snprintf (p, 512, "{cnt:%d,uuid:<1,%" PRIx64 ">,name:\"%s\"%s%s,flags:[%s],type:%d}", 2583 p += snprintf (p, 512, "{cnt:%d,uuid:<1.%" PRIx64 ">,name:\"%s\"%s%s,flags:[%s],type:%d}",
2577 count, uuid.seq, 2584 count, uuid.seq,
2578 &name, 2585 &name,
2579 title ? "\",title:\"" : "", 2586 title ? "\",title:\"" : "",
2580 title ? (const char *)title : "", 2587 title ? (const char *)title : "",
2581 flag_desc (flagdesc, 512), type); 2588 flag_desc (flagdesc, 512), type);
2601{ 2608{
2602 static char info[256 * 4]; 2609 static char info[256 * 4];
2603 return debug_desc (info); 2610 return debug_desc (info);
2604} 2611}
2605 2612
2613struct region *
2614object::region () const
2615{
2616 return map ? map->region (x, y)
2617 : region::default_region ();
2618}
2619

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines