Fix pathfinding again

This commit is contained in:
2024-02-13 16:25:27 +01:00
parent f066ae1b3d
commit e6ddafd3e2

View File

@@ -192,7 +192,7 @@ bool pathfindAStar(const PathfindingDesc *desc) {
x < 0 || x >= map->width)
continue;
// 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;
PathNodeRecord *curRecord = &closedSet[y * map->width + x];
if (curRecord->visited)
@@ -265,7 +265,7 @@ bool pathfindAStar(const PathfindingDesc *desc) {
}
reversePath(pathData);
if (pathLen > 2)
if (false && pathLen > 2)
smoothPath(map, pathData, desc->pool);
*desc->outPath = (Path) {pathData, 0};
}