Basic wood chopping

This commit is contained in:
2023-12-10 11:08:40 +01:00
parent b410867902
commit 11832ec1cc
10 changed files with 224 additions and 45 deletions

View File

@@ -139,7 +139,9 @@ bool pathfindAStar(const PathfindingDesc *desc) {
pathData->waypoints[0] = desc->target;
pathData->numWaypoints = 1;
pathData->next = NULL;
*desc->outPath = (Path) {pathData, 0};
if (desc->outPath)
*desc->outPath = (Path) {pathData, 0};
return true;
}
@@ -272,7 +274,7 @@ bool pathfindAStar(const PathfindingDesc *desc) {
bzStackAllocFree(desc->alloc, openSet.arr);
bzStackAllocFree(desc->alloc, closedSet);
return foundPath ? pathLen : -1;
return foundPath;
}
static void heapSwap(Heap *heap, i32 left, i32 right) {