Testing
This commit is contained in:
42
util/pathfinding.h
Normal file
42
util/pathfinding.h
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// 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
|
Reference in New Issue
Block a user