… | |
… | |
901 | * This function removes the object op from the linked list of objects |
901 | * 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 |
902 | * which it is currently tied to. When this function is done, the |
903 | * object will have no environment. If the object previously had an |
903 | * object will have no environment. If the object previously had an |
904 | * environment, the x and y coordinates will be updated to |
904 | * environment, the x and y coordinates will be updated to |
905 | * the previous environment. |
905 | * the previous environment. |
906 | * Beware: This function is called from the editor as well! |
|
|
907 | */ |
906 | */ |
908 | void |
907 | void |
909 | object::remove_slow () |
908 | object::remove_slow () |
910 | { |
909 | { |
911 | object *tmp, *last = 0; |
910 | object *tmp, *last = 0; |
… | |
… | |
1968 | } |
1967 | } |
1969 | |
1968 | |
1970 | if (!index) |
1969 | if (!index) |
1971 | return -1; |
1970 | return -1; |
1972 | |
1971 | |
1973 | return altern[RANDOM () % index]; |
1972 | return altern [rndm (index)]; |
1974 | } |
1973 | } |
1975 | |
1974 | |
1976 | /* |
1975 | /* |
1977 | * find_first_free_spot(archetype, maptile, x, y) works like |
1976 | * find_first_free_spot(archetype, maptile, x, y) works like |
1978 | * find_free_spot(), but it will search max number of squares. |
1977 | * find_free_spot(), but it will search max number of squares. |
… | |
… | |
1999 | { |
1998 | { |
2000 | arr += begin; |
1999 | arr += begin; |
2001 | end -= begin; |
2000 | end -= begin; |
2002 | |
2001 | |
2003 | while (--end) |
2002 | while (--end) |
2004 | swap (arr [end], arr [RANDOM () % (end + 1)]); |
2003 | swap (arr [end], arr [rndm (end + 1)]); |
2005 | } |
2004 | } |
2006 | |
2005 | |
2007 | /* new function to make monster searching more efficient, and effective! |
2006 | /* new function to make monster searching more efficient, and effective! |
2008 | * This basically returns a randomized array (in the passed pointer) of |
2007 | * 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 |
2008 | * the spaces to find monsters. In this way, it won't always look for |