[Fix] Pathfinding doesn't seg fault anymore?

This commit is contained in:
Allanis 2013-06-16 16:05:04 +01:00
parent 7547bb80c5
commit bc0ebf678e

View File

@ -313,10 +313,10 @@ StarSystem** system_getJumpPath(int* njumps, char* sysstart, char* sysend) {
neighbour = A_newNode(&systems_stack[cur->sys->jumps[i]], cur);
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.
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.
if(!A_in(open, neighbour->sys) && !A_in(closed, neighbour->sys)) {