Hello, sorry for my late reply.
I was profiling in a debug build, I didn't think of that beeing able to influence the performance. Switching it improved the speed by like 25%.
I never used a profiler before, but if you are able to point me to a good one, I'd be willing to give it a try.
I'm still pushing twice instead of updateing the nodes. I take it you suggest updating rather than doing that?
I'm storing the nodes in a simple 2D array
node *map[size][size];
Here is the .h of the node class:
class node{
public:
node *parent;
int2 pos;
D3DXVECTOR2 posInNode;
bool isOpen;
bool isOnClosedList, isOnOpenList; // not using closedlist, and isOnOpenList lets me skip the sorting through the openlist when I want to see if a node is on it
int costF, costG, costH;
bool pushedOntoQueue;
public:
node(){
resetData();
isOpen = true;
pos = int2(0, 0);
}
node(int2 posIn){
pos = posIn;
isOpen = true;
resetData();
}
~node(){}
// reset for reusing
void resetData(){
posInNode = D3DXVECTOR2(-1, -1);
parent = NULL;
costF = costG = costH = 0;
isOnClosedList = false;
isOnOpenList = false;
pushedOntoQueue = false;
}
};
This is what I use in the priorityqueue instead of the full Node:
struct nodePH{
int2 pos;
int costF;
bool operator<(const nodePH &right) const{
return (costF > right.costF);
}
};