diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-03-19 08:19:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-19 08:19:59 +0100 |
commit | 256ac9a51d2500bd52a8d6ff751851338f3fd8e2 (patch) | |
tree | bb279f1a44659544375650f87b053cce42d60ffc /core/math/a_star.h | |
parent | cf50ee4fa4f6a254a4706d4afa0adf10311a5ffb (diff) | |
parent | bad77bcb529b83daabb29b5aa57776ec18ee5a0e (diff) | |
download | redot-engine-256ac9a51d2500bd52a8d6ff751851338f3fd8e2.tar.gz |
Merge pull request #37039 from Chaosus/astar2d_cost
Implements estimate/compute_cost for AStar2D
Diffstat (limited to 'core/math/a_star.h')
-rw-r--r-- | core/math/a_star.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/math/a_star.h b/core/math/a_star.h index bfcf0c09d3..cc6c4619e9 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -43,6 +43,7 @@ class AStar : public Reference { GDCLASS(AStar, Reference); + friend class AStar2D; struct Point { @@ -124,8 +125,8 @@ class AStar : public Reference { protected: static void _bind_methods(); - virtual float _estimate_cost(int p_from_id, int p_to_id); - virtual float _compute_cost(int p_from_id, int p_to_id); + virtual real_t _estimate_cost(int p_from_id, int p_to_id); + virtual real_t _compute_cost(int p_from_id, int p_to_id); public: int get_available_point_id() const; @@ -166,9 +167,14 @@ class AStar2D : public Reference { GDCLASS(AStar2D, Reference); AStar astar; + bool _solve(AStar::Point *begin_point, AStar::Point *end_point); + protected: static void _bind_methods(); + virtual real_t _estimate_cost(int p_from_id, int p_to_id); + virtual real_t _compute_cost(int p_from_id, int p_to_id); + public: int get_available_point_id() const; |