Fix pathfinding again
This commit is contained in:
@@ -192,7 +192,7 @@ bool pathfindAStar(const PathfindingDesc *desc) {
|
|||||||
x < 0 || x >= map->width)
|
x < 0 || x >= map->width)
|
||||||
continue;
|
continue;
|
||||||
// not walkable
|
// not walkable
|
||||||
if (bzTileMapHasAnyCollision(map, x, y) && x != target.x && y != target.y)
|
if (bzTileMapHasAnyCollision(map, x, y) && (x != target.x || y != target.y))
|
||||||
continue;
|
continue;
|
||||||
PathNodeRecord *curRecord = &closedSet[y * map->width + x];
|
PathNodeRecord *curRecord = &closedSet[y * map->width + x];
|
||||||
if (curRecord->visited)
|
if (curRecord->visited)
|
||||||
@@ -265,7 +265,7 @@ bool pathfindAStar(const PathfindingDesc *desc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reversePath(pathData);
|
reversePath(pathData);
|
||||||
if (pathLen > 2)
|
if (false && pathLen > 2)
|
||||||
smoothPath(map, pathData, desc->pool);
|
smoothPath(map, pathData, desc->pool);
|
||||||
*desc->outPath = (Path) {pathData, 0};
|
*desc->outPath = (Path) {pathData, 0};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user