Closed SquidDev closed 9 years ago
I must be missing something. Where does it add visited nodes to the visited
set?
In the enqueue
method. It is something like if(visited.add(location))
. Visited returns false
if it is already in the set.
There we go, found it. Anyway, the issue now is that we're adding every location to the visited
set, regardless of whether it can be visited or not. So if we try to visit a node through a cover, it gets added to visited
, but doesn't get visited because of the cover. Then we don't try to visit it again from any other direction.
Yeah. You're right there. The thing is I want to ideally avoid fetching the node multiple times as the slowest bit will be running through the node providers. However storing the direction in the search location also doesn't work as otherwise we cannot find it.
I think we just have to only add a node to visited
when we actually visit it.
The visitor currently visits every side that is connected on the node. This means that a packet can be received more than once on a network - as well as we scan peripherals multiple times on one node and we call
networkInvalidated
multiple times.An alternative would be instead of testing for equality by checking the side we should test if this node isn't null and if it hasn't been visited already. This might require a rewrite of bits of the visitor though so should be fixed after
feature/api-rewrites
is merged.