43 lines
758 B
C
43 lines
758 B
C
//
|
|
// Created by bruno on 7.6.2025.
|
|
//
|
|
|
|
#ifndef FACTORYGAME_PATHFINDING_H
|
|
#define FACTORYGAME_PATHFINDING_H
|
|
|
|
#include <stdint.h>
|
|
#include "../tiles/tile.h"
|
|
|
|
//extern uint32_t globalPathfindingVersion;
|
|
//#define MAX_OPEN_NODES (MAP_WIDTH * MAP_HEIGHT)
|
|
#define MAX_OPEN_NODES 100
|
|
|
|
typedef struct Node {
|
|
MiniRect pos;
|
|
int fCost;
|
|
} Node;
|
|
|
|
typedef struct {
|
|
MiniRect steps[MAX_OPEN_NODES];
|
|
int stepIndex;
|
|
int length;
|
|
} Path;
|
|
|
|
|
|
extern Node openList[MAX_OPEN_NODES];
|
|
extern int openCount;
|
|
|
|
int heuristic(MiniRect a, MiniRect b);
|
|
|
|
Path reconstruct_path(MiniRect end);
|
|
|
|
bool find_path(MiniRect start, MiniRect end);
|
|
|
|
Node pop_best_node();
|
|
|
|
void add_to_open(MiniRect pos, int fCost);
|
|
|
|
void clear_pathfind_data();
|
|
|
|
#endif //FACTORYGAME_PATHFINDING_H
|