Hey guys ! I just started a little project on the A* algorithm and got an access violation. I can't see what's wrong with my code =/
Here's the code:
Where:Code:std::string Map[] = { "cccccccccccccccc" "cooooooooooooooc", "cooooooocooooooc", "cooooooocooooooc", "coooosoocooooooc", "cooooooocooooooc", "cooooooooooceooc", "cooooooooooooooc", "cccccccccccccccc" }; struct Move { Move() : f(0), g(0), h(0), x(0), y(0), parent(0) { }; bool operator < (const Move& m) { return (f < m.f); } bool operator == (const Move& m) { return (x == m.x) && (y == m.y); } int f, g, h, x, y; Move* parent; }; std::vector<Move> Open, Closed; void FindPoint(Move* m, char c) { for(int i = 1; i < Map[0].size() - 1; i++) { for(int j = 1; j < (9 - 1); j++) { if(Map[i][j] == c) { m->x = i; m->y = j; break; } } } }
c = 's', i = 12, j = 1
This piece of code basically searches for the 's' character and changes the struct if it is found. Does anyone have an idea why this access violation happens ?
Thanks.



LinkBack URL
About LinkBacks



