Overhaul pathfinding algorithm
This commit is contained in:
@@ -117,12 +117,12 @@ void updatePlayerInput(ecs_iter_t *it) {
|
||||
|
||||
const Position *start = ecs_get(ECS, entity, Position);
|
||||
Path path = {NULL, 0};
|
||||
findPath(&(PathfindingDesc) {
|
||||
.start=*start,
|
||||
.target=target,
|
||||
.map=map,
|
||||
.outPath=&path,
|
||||
.pool=game->pools.pathData
|
||||
pathfindAStar(&(PathfindingDesc) {
|
||||
.start=*start,
|
||||
.target=target,
|
||||
.map=map,
|
||||
.outPath=&path,
|
||||
.pool=game->pools.pathData
|
||||
});
|
||||
if (!path.paths) continue;
|
||||
ecs_set_ptr(ECS, entity, Path, &path);
|
||||
@@ -134,12 +134,12 @@ void updatePlayerInput(ecs_iter_t *it) {
|
||||
|
||||
const Position *start = ecs_get(ECS, entity, Position);
|
||||
Path path = {NULL, 0};
|
||||
findPath(&(PathfindingDesc) {
|
||||
.start=*start,
|
||||
.target=worldPos,
|
||||
.map=map,
|
||||
.outPath=&path,
|
||||
.pool=game->pools.pathData
|
||||
pathfindAStar(&(PathfindingDesc) {
|
||||
.start=*start,
|
||||
.target=worldPos,
|
||||
.map=map,
|
||||
.outPath=&path,
|
||||
.pool=game->pools.pathData
|
||||
});
|
||||
if (!path.paths) continue;
|
||||
ecs_set_ptr(ECS, entity, Path, &path);
|
||||
|
||||
Reference in New Issue
Block a user