diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-10-06 11:13:10 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-10-06 11:13:38 +0200 |
commit | 0ae7af6e1c6a4d30acddb4e2a0a4791aa02909d2 (patch) | |
tree | a5b793be13effa0fd28e6bfda82f6ccb297a2fd2 /src | |
parent | fe0f4b6e959e834c1f0fe45e14c4f953f5b85aac (diff) |
bbn
Diffstat (limited to 'src')
-rw-r--r-- | src/path-search.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/path-search.cpp b/src/path-search.cpp index 365791de..f8d0a64f 100644 --- a/src/path-search.cpp +++ b/src/path-search.cpp @@ -130,14 +130,15 @@ auto path_search::always_continue() noexcept -> const pred& { return always_cont void path_search::ensure_allocated(chunk_coords a, chunk_coords b) { + constexpr auto max_chunks = 1uz << 26; auto new_size = (Math::abs(a - b) + Vector2i(3)); auto new_start = Vector2i(std::min(a.x, b.x), std::min(a.y, b.y)) - Vector2i(1); - auto size1 = new_size.product(); - fm_debug_assert(size1 > 0); + auto size1 = (size_t)new_size.product(); + fm_assert(size1 < max_chunks); cache.start = new_start; - if ((size_t)size1 > cache.array.size()) + if (size1 > cache.array.size()) { - cache.array = Array<chunk_tiles_cache>{ValueInit, (size_t)size1}; + cache.array = Array<chunk_tiles_cache>{ValueInit, size1}; cache.size = new_size; } else |