diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-10-08 06:53:45 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-10-08 06:53:45 +0200 |
commit | c84d0fc943ccb0340046a8bdb74006ef796b2756 (patch) | |
tree | 7ef5daa04c55f15089cb25f2ed0be91c786c5636 /src/path-search-dijkstra.cpp | |
parent | 54af7f5b75ada6be57922f8ec7d85e4bfbd3e80a (diff) |
now use Math::sqrt at compile time
Diffstat (limited to 'src/path-search-dijkstra.cpp')
-rw-r--r-- | src/path-search-dijkstra.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/path-search-dijkstra.cpp b/src/path-search-dijkstra.cpp index e88461dd..4a71ef8d 100644 --- a/src/path-search-dijkstra.cpp +++ b/src/path-search-dijkstra.cpp @@ -14,6 +14,7 @@ namespace { constexpr auto chunk_size = iTILE_SIZE2 * TILE_MAX_DIM; constexpr auto div_size = path_search::div_size; constexpr auto min_size = path_search::min_size; +constexpr auto goal_distance = div_size; template<typename T> requires std::is_arithmetic_v<T> @@ -40,7 +41,7 @@ constexpr auto directions = [] constexpr { struct pair { Vector2i dir; uint32_t len; }; constexpr auto len1 = div_size; - constexpr auto len2 = (uint32_t)(math::sqrt((float)len1.dot()) + 0.5f); // NOLINT + constexpr auto len2 = (uint32_t)(len1.length() + 0.5f); // NOLINT std::array<pair, 8> array = {{ { { -1, -1 }, len2 }, { { 1, 1 }, len2 }, |