mirror of
https://github.com/tbamud/tbamud.git
synced 2026-01-24 18:06:09 +01:00
Added diagonal directions, hidden exits flag and bug fixes
This commit is contained in:
parent
7531e92f64
commit
5acbfd29eb
33 changed files with 378 additions and 130 deletions
10
src/graph.c
10
src/graph.c
|
|
@ -89,8 +89,8 @@ static void bfs_clear_queue(void)
|
|||
bfs_dequeue();
|
||||
}
|
||||
|
||||
/* find_first_step: given a source room and a target room, find the first step
|
||||
* on the shortest path from the source to the target. Intended usage: in
|
||||
/* find_first_step: given a source room and a target room, find the first step
|
||||
* on the shortest path from the source to the target. Intended usage: in
|
||||
* mobile_activity, give a mob a dir to go if they're tracking another mob or a
|
||||
* PC. Or, a 'track' skill for PCs. */
|
||||
static int find_first_step(room_rnum src, room_rnum target)
|
||||
|
|
@ -112,7 +112,7 @@ static int find_first_step(room_rnum src, room_rnum target)
|
|||
MARK(src);
|
||||
|
||||
/* first, enqueue the first steps, saving which direction we're going. */
|
||||
for (curr_dir = 0; curr_dir < NUM_OF_DIRS; curr_dir++)
|
||||
for (curr_dir = 0; curr_dir < DIR_COUNT; curr_dir++)
|
||||
if (VALID_EDGE(src, curr_dir)) {
|
||||
MARK(TOROOM(src, curr_dir));
|
||||
bfs_enqueue(TOROOM(src, curr_dir), curr_dir);
|
||||
|
|
@ -125,7 +125,7 @@ static int find_first_step(room_rnum src, room_rnum target)
|
|||
bfs_clear_queue();
|
||||
return (curr_dir);
|
||||
} else {
|
||||
for (curr_dir = 0; curr_dir < NUM_OF_DIRS; curr_dir++)
|
||||
for (curr_dir = 0; curr_dir < DIR_COUNT; curr_dir++)
|
||||
if (VALID_EDGE(queue_head->room, curr_dir)) {
|
||||
MARK(TOROOM(queue_head->room, curr_dir));
|
||||
bfs_enqueue(TOROOM(queue_head->room, curr_dir), queue_head->dir);
|
||||
|
|
@ -170,7 +170,7 @@ ACMD(do_track)
|
|||
int tries = 10;
|
||||
/* Find a random direction. :) */
|
||||
do {
|
||||
dir = rand_number(0, NUM_OF_DIRS - 1);
|
||||
dir = rand_number(0, DIR_COUNT - 1);
|
||||
} while (!CAN_GO(ch, dir) && --tries);
|
||||
send_to_char(ch, "You sense a trail %s from here!\r\n", dirs[dir]);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue