Allow NULL as search destination to generate the entire tree
This commit is contained in:
parent
7d6082ed68
commit
25a80f7fa9
@ -137,7 +137,7 @@ int dijkstra_search_find_path(struct dijkstra_search *search,
|
|||||||
while (g_list_length(search->active_nodes) > 0) {
|
while (g_list_length(search->active_nodes) > 0) {
|
||||||
iteration++;
|
iteration++;
|
||||||
dijkstra_search_process_queue(search);
|
dijkstra_search_process_queue(search);
|
||||||
if (search->states[destination->uid]->visited)
|
if (destination && search->states[destination->uid]->visited)
|
||||||
return iteration;
|
return iteration;
|
||||||
if (iteration >= DIJKSTRA_SEARCH_MAX_ITERATIONS) {
|
if (iteration >= DIJKSTRA_SEARCH_MAX_ITERATIONS) {
|
||||||
report(LL_ERROR, "Exceeded maximum iteration limit for query.");
|
report(LL_ERROR, "Exceeded maximum iteration limit for query.");
|
||||||
@ -145,6 +145,9 @@ int dijkstra_search_find_path(struct dijkstra_search *search,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!destination)
|
||||||
|
return iteration;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user