[Fix] Pathfinding doesn't seg fault anymore?
This commit is contained in:
parent
7547bb80c5
commit
bc0ebf678e
@ -313,10 +313,10 @@ StarSystem** system_getJumpPath(int* njumps, char* sysstart, char* sysend) {
|
|||||||
neighbour = A_newNode(&systems_stack[cur->sys->jumps[i]], cur);
|
neighbour = A_newNode(&systems_stack[cur->sys->jumps[i]], cur);
|
||||||
cost = A_g(cur) + 1;
|
cost = A_g(cur) + 1;
|
||||||
|
|
||||||
if(A_in(open, neighbour->sys) && (cost < A_g(neighbour)))
|
if(A_in(open, neighbour->sys))
|
||||||
open = A_rm(open, neighbour->sys); // New path is better.
|
open = A_rm(open, neighbour->sys); // New path is better.
|
||||||
|
|
||||||
if(A_in(closed, neighbour->sys) && (cost < A_g(neighbour)))
|
if(A_in(closed, neighbour->sys))
|
||||||
closed = A_rm(closed, neighbour->sys); // Shouldn't happen.
|
closed = A_rm(closed, neighbour->sys); // Shouldn't happen.
|
||||||
|
|
||||||
if(!A_in(open, neighbour->sys) && !A_in(closed, neighbour->sys)) {
|
if(!A_in(open, neighbour->sys) && !A_in(closed, neighbour->sys)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user