I can't find anything wrong with my code. When i debug, this occurs.
Unhandled exception at 0x00fb74b1 in pacman.exe: 0xC0000005: Access violation reading location 0xfdfdfdfd.
The printf works fine, some integers are printed.Code:printf("Lowest F = %d, x:%d, y:%d", lowestf, openX[lowestf], openY[lowestf]); ScanAdjacentNodes(openX[lowestf], openX[lowestf]);
If i parse values like this there is no problem.
Code:ScanAdjacentNodes(5, 5);Code:int openX[550]; int openY[550];Code:void ScanAdjacentNodes(int x, int y) { if(FREE(x+1, y)) { f[index]=hscore(x+1, y); openX[index]=x+1; openY[index]=y; index++; } else { closedX[j] = x+1; closedY[j] = y; j++; } if(FREE(x-1, y)) { f[index]=hscore(x-1, y); openX[index]=x-1; openY[index]=y; index++; } else { closedX[j] = x-1; closedY[j] = y; j++; } if(FREE(x, y+1)) { f[index]=hscore(x, y+1); openX[index]=x; openY[index]=y+1; index++; } else { closedX[j] = x; closedY[j] = y+1; j++; } if(FREE(x, y-1)) { f[index]=hscore(x, y-1); openX[index]=x; openY[index]=y-1; index++; } else { closedX[j] = x; closedY[j] = y-1; j++; } }



LinkBack URL
About LinkBacks



