Merge pull request #82297 from sadikkuzu/master

Fix typo in `heuristic_euclidian` helper in AStarGrid2D
This commit is contained in:
Rémi Verschelde 2023-09-25 17:18:55 +02:00
commit 82f6e9be5e
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -32,7 +32,7 @@
#include "core/variant/typed_array.h"
static real_t heuristic_euclidian(const Vector2i &p_from, const Vector2i &p_to) {
static real_t heuristic_euclidean(const Vector2i &p_from, const Vector2i &p_to) {
real_t dx = (real_t)ABS(p_to.x - p_from.x);
real_t dy = (real_t)ABS(p_to.y - p_from.y);
return (real_t)Math::sqrt(dx * dx + dy * dy);
@ -57,7 +57,7 @@ static real_t heuristic_chebyshev(const Vector2i &p_from, const Vector2i &p_to)
return MAX(dx, dy);
}
static real_t (*heuristics[AStarGrid2D::HEURISTIC_MAX])(const Vector2i &, const Vector2i &) = { heuristic_euclidian, heuristic_manhattan, heuristic_octile, heuristic_chebyshev };
static real_t (*heuristics[AStarGrid2D::HEURISTIC_MAX])(const Vector2i &, const Vector2i &) = { heuristic_euclidean, heuristic_manhattan, heuristic_octile, heuristic_chebyshev };
void AStarGrid2D::set_region(const Rect2i &p_region) {
ERR_FAIL_COND(p_region.size.x < 0 || p_region.size.y < 0);