We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c061a91 + 8edf1e3 commit f91fcfeCopy full SHA for f91fcfe
include/astar.h
@@ -100,6 +100,7 @@ namespace alg {
100
101
if(cx == (int)x2 && cy==(int)y2) { // we reached (x2,y2)
102
// reconstruct path & return
103
+ as->num_nodes = 2;
104
uint32_t tmp = x2*ncol+y2;
105
while((tmp=came_from[tmp]) != x1*ncol+y1) {
106
as->num_nodes++;
@@ -109,10 +110,14 @@ namespace alg {
109
110
111
tmp = x2*ncol+y2;
112
int idx=0;
113
+ as->path[idx++] = x2;
114
+ as->path[idx++] = y2;
115
116
as->path[idx++] = tmp/ncol;
117
as->path[idx++] = tmp%ncol;
118
}
119
+ as->path[idx++] = x1;
120
+ as->path[idx++] = y1;
121
return as;
122
123
0 commit comments