… | |
… | |
1967 | } |
1967 | } |
1968 | |
1968 | |
1969 | if (!index) |
1969 | if (!index) |
1970 | return -1; |
1970 | return -1; |
1971 | |
1971 | |
1972 | return altern[RANDOM () % index]; |
1972 | return altern [rndm (index)]; |
1973 | } |
1973 | } |
1974 | |
1974 | |
1975 | /* |
1975 | /* |
1976 | * find_first_free_spot(archetype, maptile, x, y) works like |
1976 | * find_first_free_spot(archetype, maptile, x, y) works like |
1977 | * find_free_spot(), but it will search max number of squares. |
1977 | * find_free_spot(), but it will search max number of squares. |
… | |
… | |
1998 | { |
1998 | { |
1999 | arr += begin; |
1999 | arr += begin; |
2000 | end -= begin; |
2000 | end -= begin; |
2001 | |
2001 | |
2002 | while (--end) |
2002 | while (--end) |
2003 | swap (arr [end], arr [RANDOM () % (end + 1)]); |
2003 | swap (arr [end], arr [rndm (end + 1)]); |
2004 | } |
2004 | } |
2005 | |
2005 | |
2006 | /* new function to make monster searching more efficient, and effective! |
2006 | /* new function to make monster searching more efficient, and effective! |
2007 | * This basically returns a randomized array (in the passed pointer) of |
2007 | * 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 |
2008 | * the spaces to find monsters. In this way, it won't always look for |
… | |
… | |
2600 | { |
2600 | { |
2601 | static char info[256 * 4]; |
2601 | static char info[256 * 4]; |
2602 | return debug_desc (info); |
2602 | return debug_desc (info); |
2603 | } |
2603 | } |
2604 | |
2604 | |
|
|
2605 | struct region * |
|
|
2606 | object::region () const |
|
|
2607 | { |
|
|
2608 | return map ? map->region (x, y) |
|
|
2609 | : region::default_region (); |
|
|
2610 | } |
|
|
2611 | |