Files
PixelDefense/game/pathfinding.h

40 lines
746 B
C

#ifndef PIXELDEFENSE_PATHFINDING_H
#define PIXELDEFENSE_PATHFINDING_H
#include <breeze.h>
#include "components.h"
typedef struct PathNode {
i32 weight; // fCost = g + h
i32 gCost; // from start cost
i32 hCost; // to target cost
Vec2i pos;
} PathNode;
typedef struct PathNodeRecord {
bool visited : 1;
bool open : 1;
i8 toParentX : 3;
i8 toParentY : 3;
i32 nodeIdx;
} PathNodeRecord;
typedef struct PathfindingDesc {
Position start;
Position target;
BzTileMap *map;
Path *outPath;
BzObjectPool *pool;
BzStackAlloc *alloc;
} PathfindingDesc;
bool pathfindAStar(const PathfindingDesc *desc);
// TODO: Flowfield
void calculateFlowField();
#endif //PIXELDEFENSE_PATHFINDING_H