summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-10-16 10:36:33 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-10-16 10:36:33 +0200
commitd0b8c9beb47c4c2e52afa07549823ffa3f97b178 (patch)
tree62483496694ae4354e4b95152f8ffc53ca5e1efb
parentcbc7fbf0ce84886a8c9d95b35f59d0f237c627e8 (diff)
a
-rw-r--r--bench/01-dijkstra.cpp6
-rw-r--r--src/path-search-dijkstra.cpp6
2 files changed, 6 insertions, 6 deletions
diff --git a/bench/01-dijkstra.cpp b/bench/01-dijkstra.cpp
index 1f1069ab..aecc885a 100644
--- a/bench/01-dijkstra.cpp
+++ b/bench/01-dijkstra.cpp
@@ -16,7 +16,7 @@ void Dijkstra(benchmark::State& state)
{
auto w = world();
- constexpr auto wcx = 1, wcy = 1, wtx = 8, wty = 8, wox = 3, woy = 3;
+ constexpr auto wcx = 1, wcy = 1, wtx = 8, wty = 8, wox = 0, woy = 0;
constexpr auto max_dist = (uint32_t)(Vector2i(Math::abs(wcx)+1, Math::abs(wcy)+1)*TILE_MAX_DIM*iTILE_SIZE2).length();
constexpr auto wch = chunk_coords_{wcx, wcy, 0};
constexpr auto wt = local_coords{wtx, wty};
@@ -39,7 +39,7 @@ void Dijkstra(benchmark::State& state)
ch[{ wtx, wty }].wall_west() = metal2;
ch[{ wtx, wty }].wall_north() = metal2;
ch[{ wtx+1, wty }].wall_west() = metal2;
- ch[{ wtx, wty -1}].wall_north() = metal2;
+ ch[{ wtx, wty +1}].wall_north() = metal2;
for (int16_t j = wcy - 1; j <= wcy + 1; j++)
for (int16_t i = wcx - 1; i <= wcx + 1; i++)
@@ -53,7 +53,7 @@ void Dijkstra(benchmark::State& state)
A.Dijkstra(w,
{{0,0,0}, {11,9}}, // from
{wpos, {wox, woy}}, // to
- 0, max_dist, {32,32}, // size
+ 0, max_dist, {16,16}, // size
first_run ? 1 : 0);
};
diff --git a/src/path-search-dijkstra.cpp b/src/path-search-dijkstra.cpp
index df8dd65b..26e6b742 100644
--- a/src/path-search-dijkstra.cpp
+++ b/src/path-search-dijkstra.cpp
@@ -115,9 +115,9 @@ path_search_result astar::Dijkstra(world& w, const point from_, const point to_,
clear();
cache.allocate(from_, max_dist);
- constexpr auto min_size_ = Vector2ui{Vector2(div_size) * 1.5f + Vector2{.5f}};
- const auto own_size = Math::max(Vector2ui{Vector2{own_size_}*1.5f + Vector2{.5f}}, min_size_);
- const auto goal_distance = (uint32_t)Math::max(Vector2ui(iTILE_SIZE2*11/10), own_size * 2).length();
+ constexpr auto min_size = Vector2ui{div_size*3/2};
+ const auto own_size = Math::max(Vector2ui(own_size_), min_size);
+ constexpr auto goal_distance = (div_size*3/2).length();
const auto [from, from_offset] = from_;
const auto [to, to_offset] = to_;