7#include "square_grid.h"
12 template <
typename TILE_DATA,
bool RESIZABLE,
typename FUNC>
15 if constexpr (std::invocable<FUNC, TILE_DATA&, std::span<glm::ivec2 const>>)
17 using iteration_flags = grid<TILE_DATA, RESIZABLE>::iteration_flags;
33 else if constexpr (std::invocable<FUNC, TILE_DATA&, std::span<TILE_DATA const* const>>)
44 static_assert(std::is_same_v<TILE_DATA, FUNC>);
48 template <
typename TILE_DATA,
bool RESIZABLE,
typename FUNC>
55 template <
typename TILE_DATA,
bool RESIZABLE, change_tile_callback<TILE_DATA> FLOOD_FUNC, query_tile_callback<TILE_DATA> SHOULD_FLOOD_FUNC>
58 std::queue<glm::ivec2>
queue;
59 if (!grid.is_valid(start))
return;
63 while (!
queue.empty())
68 auto l =
n,
r = glm::ivec2{
n.x + 1,
n.y };
78 for (
int x =
l.x; x <=
r.x; x++)
80 glm::ivec2
pos{ x,
n.y };
83 glm::ivec2 up = {
pos.x,
pos.y - 1 }, down = {
pos.x,
pos.y + 1 };
88 if (grid.is_valid(down) &&
should_flood(down, *grid.at(down)))
94 template <
typename TILE_DATA,
bool RESIZABLE, change_tile_callback<TILE_DATA> FLOOD_FUNC>
102 template <
typename TILE_DATA,
bool RESIZABLE, query_tile_callback<TILE_DATA> SHOULD_FLOOD_FUNC>
108 template <
typename TILE_DATA,
bool RESIZABLE>
constexpr auto bit_count
Equal to the number of bits in the type.
constexpr decltype(auto) at(random_access_range auto &range, std::integral auto index)
Returns a reference to the value at index of range