diff options
| author | mat <git@matdoes.dev> | 2026-01-04 18:40:58 +0800 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2026-01-04 18:40:58 +0800 |
| commit | 91fde2dbea41a07c261cd8b85ac4c851e993efc8 (patch) | |
| tree | 79aa9df79673628297761e1ad9dd2c4ab52de71a /azalea/src/pathfinder/astar.rs | |
| parent | 53ff9c652491bc9749123452dbabcf4a51b263f3 (diff) | |
| download | azalea-drasl-91fde2dbea41a07c261cd8b85ac4c851e993efc8.tar.xz | |
return cost in pathfinder a_star function
Diffstat (limited to 'azalea/src/pathfinder/astar.rs')
| -rw-r--r-- | azalea/src/pathfinder/astar.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/azalea/src/pathfinder/astar.rs b/azalea/src/pathfinder/astar.rs index ed776bec..7bd08111 100644 --- a/azalea/src/pathfinder/astar.rs +++ b/azalea/src/pathfinder/astar.rs @@ -17,6 +17,11 @@ where { pub movements: Vec<Movement<P, M>>, pub is_partial: bool, + /// The A* cost for executing the path. + /// + /// For Azalea's pathfinder, this is generally the estimated amount of time + /// that it takes to complete the path, in ticks. + pub cost: f32, } // used for better results when timing out @@ -79,6 +84,7 @@ where return Path { movements: reconstruct_path(nodes, best_path, successors), is_partial: false, + cost: g_score, }; } @@ -168,6 +174,7 @@ where Path { movements: reconstruct_path(nodes, best_path, successors), is_partial: true, + cost: best_path_scores[best_path], } } |
