Track issue
< Newer Topic
:: Older Topic >
Pages:<< prev 1 next >>
#1 Sep 16, 2023 8:31 am
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
in track.c find function find_first_step and make it look like this
Vladaar noticed that track sometimes would find a path that went out of the area and then would lose the target even if it had a better way that didn't require it to leave the area.
int find_first_step( ROOM_INDEX_DATA * src, ROOM_INDEX_DATA * target, int maxdist ) { int curr_dir, count; EXIT_DATA *pexit; if( !src || !target ) { bug( "%s: Illegal value passed to find_first_step (track.c)", __func__ ); return BFS_ERROR; } if( src == target ) return BFS_ALREADY_THERE; if( src->area != target->area ) return BFS_NO_PATH; room_enqueue( src ); MARK( src ); /* * first, enqueue the first steps, saving which direction we're going. */ for( pexit = src->first_exit; pexit; pexit = pexit->next ) if( valid_edge( pexit ) && pexit->to_room->area == target->area ) { curr_dir = pexit->vdir; MARK( pexit->to_room ); room_enqueue( pexit->to_room ); bfs_enqueue( pexit->to_room, curr_dir ); } count = 0; while( queue_head ) { if( ++count > maxdist ) { bfs_clear_queue( ); clean_room_queue( ); return BFS_NO_PATH; } if( queue_head->room == target ) { curr_dir = queue_head->dir; bfs_clear_queue( ); clean_room_queue( ); return curr_dir; } else { for( pexit = queue_head->room->first_exit; pexit; pexit = pexit->next ) if( valid_edge( pexit ) && pexit->to_room->area == target->area ) { curr_dir = pexit->vdir; MARK( pexit->to_room ); room_enqueue( pexit->to_room ); bfs_enqueue( pexit->to_room, queue_head->dir ); } bfs_dequeue( ); } } clean_room_queue( ); return BFS_NO_PATH; }
Vladaar noticed that track sometimes would find a path that went out of the area and then would lose the target even if it had a better way that didn't require it to leave the area.
#2 Feb 4, 2024 10:24 pm
Conjurer
GroupMembers
Posts423
JoinedMar 7, 2005
Am I wrong or doesn't this fix then make it so that you can never track someone outside the same area? Isn't it more fun if hunters follow you through portals and the like, to make it harder to escape?
#3 Feb 5, 2024 12:44 pm
Black Hand
GroupAdministrators
Posts3,697
JoinedJan 1, 2002
Looks like it to me. It's not something I'd consider a bug in itself. If it's picking a longer path that leaves the area before coming back, then maybe the algorithm itself needs to be tweaked to favor remaining in the area?
#4 Feb 10, 2024 7:35 pm
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
well this is the fix to stop it from giving you a longer path because the second you left the area it would turn around and not allow you to track the npc. In most places it doesn't allow tracking outside of the area so it was easiest to skip it taking you out of the area first. Of course everyone can fix it as they see fit. this was the best way to fix it in his case since the other way led straight to the npc where as once he followed the path it took him down he was outside the area and it wouldn't try to track it anymore.
#5 Feb 12, 2024 8:01 pm
Geomancer
GroupAdministrators
Posts1,946
JoinedJul 26, 2005
main reason it is a bug is because in every other part of track it checks to make sure you are in the same area already, consider this one that was missed and causing it to act out of fashion for it lol. Now I'm like yall and always figured it would be better to be any area maybe just limit based on amount of rooms but this was probably done to cut down on lag etc....
Pages:<< prev 1 next >>