Hi,
I'm experimenting with A Star pathfinding.
I'm having a problem with a function. I'm getting the next error after running it:
Unhandled exception at 0x76ec15de in A Star Pathfinding.exe: 0xC0000005: Access violation reading location 0x08e463a8.
the function's code is:
void addAdjacent(list* oList, list* cList, int tileMap[][40])
{
node* newParent = oList->nlist[oList->index];
for(int y=-1; y <= 1; y++)
{
for(int x=-1; x <= 1; x++)
{
if(y == 0 && x==0){continue;}//skip checking the center node
node newNode;
newNode.parent = newParent;
newNode.setPos(newParent->x + x,newParent->y + y);
if(validNode(&newNode, tileMap) == true && inList(&newNode, cList) == false)
{
oList->addNode(&newNode);
tileMap[newNode.y][newNode.x] = 4;
}
}
}
cList->addNode(newParent);//add center node to closed list
tileMap[newParent->y][newParent->x] = 5;
}
When I tried to debug it seems that the error happened in the last loop.
When I press "continue" after the error, the error seems to happen in tidtable.c in the line
PFLS_GETVALUE_FUNCTION flsGetValue = FLS_GETVALUE;
I don't know what cause this problem. I tried to google for the errors and couldn't find a solution.
Help will be appreciated!