… | |
… | |
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); |
… | |
… | |
1967 | } |
1975 | } |
1968 | |
1976 | |
1969 | if (!index) |
1977 | if (!index) |
1970 | return -1; |
1978 | return -1; |
1971 | |
1979 | |
1972 | return altern[RANDOM () % index]; |
1980 | return altern [rndm (index)]; |
1973 | } |
1981 | } |
1974 | |
1982 | |
1975 | /* |
1983 | /* |
1976 | * find_first_free_spot(archetype, maptile, x, y) works like |
1984 | * find_first_free_spot(archetype, maptile, x, y) works like |
1977 | * find_free_spot(), but it will search max number of squares. |
1985 | * find_free_spot(), but it will search max number of squares. |
… | |
… | |
1998 | { |
2006 | { |
1999 | arr += begin; |
2007 | arr += begin; |
2000 | end -= begin; |
2008 | end -= begin; |
2001 | |
2009 | |
2002 | while (--end) |
2010 | while (--end) |
2003 | swap (arr [end], arr [RANDOM () % (end + 1)]); |
2011 | swap (arr [end], arr [rndm (end + 1)]); |
2004 | } |
2012 | } |
2005 | |
2013 | |
2006 | /* new function to make monster searching more efficient, and effective! |
2014 | /* new function to make monster searching more efficient, and effective! |
2007 | * This basically returns a randomized array (in the passed pointer) of |
2015 | * This basically returns a randomized array (in the passed pointer) of |
2008 | * 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 |
… | |
… | |
2600 | { |
2608 | { |
2601 | static char info[256 * 4]; |
2609 | static char info[256 * 4]; |
2602 | return debug_desc (info); |
2610 | return debug_desc (info); |
2603 | } |
2611 | } |
2604 | |
2612 | |
|
|
2613 | struct region * |
|
|
2614 | object::region () const |
|
|
2615 | { |
|
|
2616 | return map ? map->region (x, y) |
|
|
2617 | : region::default_region (); |
|
|
2618 | } |
|
|
2619 | |