Files
PixelDefense/game/pathfinding.h
2023-11-23 19:01:28 +01:00

38 lines
791 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
bool visited;
TilePosition pos;
} PathNode;
typedef struct PathClosedNode {
bool visited : 1;
i8 x : 3;
i8 y : 3;
} PathClosedNode;
typedef struct PathfindingDesc {
Position start;
Position target;
BzObjectPool *pool;
BzTileMap *map;
PathNode *openSet; // heap (size: width * height)
PathClosedNode *closedSet; // size: width * height
Path *outPath;
} PathfindingDesc;
bool findPath(const PathfindingDesc *desc);
// TODO: Flowfield
void calculateFlowField();
#endif //PIXELDEFENSE_PATHFINDING_H