… | |
… | |
1983 | * to search (see the freearr_x/y[] definition). |
1983 | * to search (see the freearr_x/y[] definition). |
1984 | * It returns a random choice among the alternatives found. |
1984 | * It returns a random choice among the alternatives found. |
1985 | * start and stop are where to start relative to the free_arr array (1,9 |
1985 | * start and stop are where to start relative to the free_arr array (1,9 |
1986 | * does all 4 immediate directions). This returns the index into the |
1986 | * does all 4 immediate directions). This returns the index into the |
1987 | * array of the free spot, -1 if no spot available (dir 0 = x,y) |
1987 | * array of the free spot, -1 if no spot available (dir 0 = x,y) |
1988 | * Note - this only checks to see if there is space for the head of the |
|
|
1989 | * object - if it is a multispace object, this should be called for all |
|
|
1990 | * pieces. |
|
|
1991 | * Note2: This function does correctly handle tiled maps, but does not |
1988 | * Note: This function does correctly handle tiled maps, but does not |
1992 | * inform the caller. However, insert_ob_in_map will update as |
1989 | * inform the caller. However, insert_ob_in_map will update as |
1993 | * necessary, so the caller shouldn't need to do any special work. |
1990 | * necessary, so the caller shouldn't need to do any special work. |
1994 | * Note - updated to take an object instead of archetype - this is necessary |
1991 | * Note - updated to take an object instead of archetype - this is necessary |
1995 | * because arch_blocked (now ob_blocked) needs to know the movement type |
1992 | * because arch_blocked (now ob_blocked) needs to know the movement type |
1996 | * to know if the space in question will block the object. We can't use |
1993 | * to know if the space in question will block the object. We can't use |
… | |
… | |
2041 | |
2038 | |
2042 | /* Note it is intentional that we check ob - the movement type of the |
2039 | /* Note it is intentional that we check ob - the movement type of the |
2043 | * head of the object should correspond for the entire object. |
2040 | * head of the object should correspond for the entire object. |
2044 | */ |
2041 | */ |
2045 | if (OB_TYPE_MOVE_BLOCK (ob, ms.move_block)) |
2042 | if (OB_TYPE_MOVE_BLOCK (ob, ms.move_block)) |
|
|
2043 | continue; |
|
|
2044 | |
|
|
2045 | if (ob->blocked (m, pos.x, pos.y)) |
2046 | continue; |
2046 | continue; |
2047 | |
2047 | |
2048 | altern [index++] = i; |
2048 | altern [index++] = i; |
2049 | } |
2049 | } |
2050 | |
2050 | |